Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Challenge: Unmatched Records Report | Core Join Types and Their Applications
SQL Joins in Depth

bookChallenge: Unmatched Records Report

Завдання

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.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 6
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

bookChallenge: Unmatched Records Report

Свайпніть щоб показати меню

Завдання

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.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 6
single

single

some-alt