Complete the code to find common customers in both tables.
SELECT customer_id FROM orders_2023 [1] SELECT customer_id FROM orders_2024;The INTERSECT keyword returns rows common to both queries.
Complete the code to find customers who ordered in 2023 but not in 2024.
SELECT customer_id FROM orders_2023 [1] SELECT customer_id FROM orders_2024;The EXCEPT keyword returns rows from the first query that are not in the second.
Fix the error in the query to find customers who ordered in 2024 but not in 2023.
SELECT customer_id FROM orders_2024 [1] SELECT customer_id FROM orders_2023;To find customers in 2024 but not in 2023, use EXCEPT with 2024 first.
Fill both blanks to find customers who ordered in 2023 or 2024 but not both.
SELECT customer_id FROM orders_2023 [1] SELECT customer_id FROM orders_2024 EXCEPT SELECT customer_id FROM orders_2023 [2] SELECT customer_id FROM orders_2024;
This query finds customers in either year but excludes those in both by subtracting the INTERSECT from the UNION.
Fill all three blanks to find customers who ordered in 2023 but not in 2024, showing their names and IDs.
SELECT [1], customer_id FROM customers WHERE customer_id IN ( SELECT customer_id FROM orders_2023 [2] SELECT customer_id FROM orders_2024 ) [3] ORDER BY customer_id;
This query selects customer names and IDs for those who ordered in 2023 but not 2024, limiting results to 10.