Challenge: Unmatched Records Report
Oppgave
Swipe to start coding
Write a SQL query that uses FULL OUTER JOIN to list all customers and all orders, showing which customers do not have any orders and which orders do not have a matching customer.
- Join the
customersandorderstables using aFULL OUTER JOINon thecustomer_idfield. - Select the
customer_idandnamefrom thecustomerstable, and theorder_idandorder_datefrom theorderstable. - Add a column named
match_statusthat indicates:'Customer without orders'if the customer has no matching order.'Order without customer'if the order has no matching customer.'Matched'if both customer and order exist.
- Order the results so that unmatched records appear first, followed by matched records.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 6
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Fantastisk!
Completion rate forbedret til 4.76
Challenge: Unmatched Records Report
Sveip for å vise menyen
Oppgave
Swipe to start coding
Write a SQL query that uses FULL OUTER JOIN to list all customers and all orders, showing which customers do not have any orders and which orders do not have a matching customer.
- Join the
customersandorderstables using aFULL OUTER JOINon thecustomer_idfield. - Select the
customer_idandnamefrom thecustomerstable, and theorder_idandorder_datefrom theorderstable. - Add a column named
match_statusthat indicates:'Customer without orders'if the customer has no matching order.'Order without customer'if the order has no matching customer.'Matched'if both customer and order exist.
- Order the results so that unmatched records appear first, followed by matched records.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 6
single