Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
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.
✗ Incorrect
The INTERSECT keyword returns only the rows that appear in both queries.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
INTERSECT returns only product IDs that appear in both sales_2023 and sales_2024.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using JOIN without ON clause causes syntax error.
Using UNION returns all emails, not just common ones.
✗ Incorrect
To get common emails, use INTERSECT. JOIN and WHERE are incorrect here.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION returns all IDs, not just common ones.
Using DESC orders in descending order, not ascending.
✗ Incorrect
Use INTERSECT to get common IDs and ASC to order ascending.
5fill in blank
hardFill 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'
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.
✗ Incorrect
INTERSECT finds common products, > filters prices above 100, and ASC orders prices ascending.