Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Unmatched Records Report | Core Join Types and Their Applications
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
SQL Joins in Depth

bookChallenge: 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 customers and orders tables using a FULL OUTER JOIN on the customer_id field.
  • Select the customer_id and name from the customers table, and the order_id and order_date from the orders table.
  • Add a column named match_status that 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 ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 6
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: 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 customers and orders tables using a FULL OUTER JOIN on the customer_id field.
  • Select the customer_id and name from the customers table, and the order_id and order_date from the orders table.
  • Add a column named match_status that 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

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 6
single

single

some-alt