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

bookChallenge: Unmatched Records Report

Aufgabe

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.

Lösung

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 6
single

single

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Suggested prompts:

Can you explain that in more detail?

What are the main benefits or drawbacks?

Can you give me an example?

close

bookChallenge: Unmatched Records Report

Swipe um das Menü anzuzeigen

Aufgabe

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.

Lösung

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 6
single

single

some-alt