0
0
SQLquery~10 mins

EXCEPT (MINUS) for differences in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all rows from table1 that are not in table2.

SQL
SELECT * FROM table1 [1] SELECT * FROM table2;
Drag options to blanks, or click blank then click option'
AEXCEPT
BUNION
CINTERSECT
DJOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION instead of EXCEPT returns all rows combined.
Using INTERSECT returns only common rows, not differences.
2fill in blank
medium

Complete the code to find customers in orders2023 but not in orders2022.

SQL
SELECT customer_id FROM orders2023 [1] SELECT customer_id FROM orders2022;
Drag options to blanks, or click blank then click option'
AUNION
BEXCEPT
CJOIN
DWHERE
Attempts:
3 left
💡 Hint
Common Mistakes
Using JOIN will combine rows but not filter differences.
Using UNION will merge all customers, not exclude.
3fill in blank
hard

Fix the error in the code to get products in inventory2024 but not in inventory2023.

SQL
SELECT product_id FROM inventory2024 [1] SELECT product_id FROM inventory2023;
Drag options to blanks, or click blank then click option'
AUNION ALL
BINTERSECT
CEXCEPT
DGROUP BY
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION ALL returns all rows including duplicates.
Using INTERSECT returns only common rows, not differences.
4fill in blank
hard

Fill both blanks to find employees in deptA but not in deptB, selecting only their IDs and names.

SQL
SELECT [1] FROM deptA [2] SELECT employee_id, name FROM deptB;
Drag options to blanks, or click blank then click option'
Aemployee_id, name
BJOIN
CEXCEPT
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting * returns all columns, which may not match second query columns.
Using JOIN does not find differences.
5fill in blank
hard

Fill all three blanks to find unique product codes in warehouse1 but not in warehouse2, selecting code, name, and quantity.

SQL
SELECT [1] FROM warehouse1 [2] SELECT [3] FROM warehouse2;
Drag options to blanks, or click blank then click option'
Aproduct_code, name, quantity
BEXCEPT
DJOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using JOIN instead of EXCEPT returns combined rows, not differences.
Selecting different columns in each query causes errors.