Challenge: Unmatched Records Report
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 6
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Génial!
Completion taux amélioré à 4.76
Challenge: Unmatched Records Report
Glissez pour afficher le menu
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 1. Chapitre 6
single