0
0
SQLquery~10 mins

INTERSECT for common rows 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 common rows from two tables.

SQL
SELECT * FROM employees [1] SELECT * FROM managers;
Drag options to blanks, or click blank then click option'
AINTERSECT
BUNION
CEXCEPT
DJOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION instead of INTERSECT returns all rows from both tables.
Using JOIN without ON clause causes syntax error.
2fill in blank
medium

Complete the code to find common product IDs from two tables.

SQL
SELECT product_id FROM sales_2023 [1] SELECT product_id FROM sales_2024;
Drag options to blanks, or click blank then click option'
AUNION ALL
BEXCEPT
CINTERSECT
DLEFT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION ALL returns all product IDs, including duplicates.
Using LEFT JOIN returns all from first table, not just common.
3fill in blank
hard

Fix the error in the query to get common customer emails from two tables.

SQL
SELECT email FROM customers_2022 [1] SELECT email FROM customers_2023;
Drag options to blanks, or click blank then click option'
AUNION
BWHERE
CJOIN
DINTERSECT
Attempts:
3 left
💡 Hint
Common Mistakes
Using JOIN without ON clause causes syntax error.
Using UNION returns all emails, not just common ones.
4fill in blank
hard

Fill both blanks to select common employee IDs and order them ascending.

SQL
SELECT employee_id FROM dept_a [1] SELECT employee_id FROM dept_b ORDER BY employee_id [2];
Drag options to blanks, or click blank then click option'
AINTERSECT
BDESC
CASC
DUNION
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION returns all IDs, not just common ones.
Using DESC orders in descending order, not ascending.
5fill in blank
hard

Fill all three blanks to select common product names and prices, filtering price above 100.

SQL
SELECT product_name, price FROM products_2022 [1] SELECT product_name, price FROM products_2023 WHERE price [2] 100 ORDER BY price [3];
Drag options to blanks, or click blank then click option'
AINTERSECT
B>
CASC
DUNION
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION returns all products, not just common ones.
Using < instead of > filters wrong prices.
Ordering by DESC sorts prices descending, not ascending.