0
0
SQLquery~10 mins

UNION combining result sets 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 combine results from two tables without duplicates.

SQL
SELECT name FROM employees [1] SELECT name FROM managers;
Drag options to blanks, or click blank then click option'
AUNION
BJOIN
CINTERSECT
DWHERE
Attempts:
3 left
💡 Hint
Common Mistakes
Using JOIN instead of UNION causes syntax errors.
Using WHERE does not combine result sets.
2fill in blank
medium

Complete the code to combine two queries including duplicates.

SQL
SELECT city FROM customers [1] SELECT city FROM suppliers;
Drag options to blanks, or click blank then click option'
AUNION ALL
BEXCEPT
CINTERSECT
DUNION
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION removes duplicates unintentionally.
Using INTERSECT or EXCEPT changes the result set meaning.
3fill in blank
hard

Fix the error in combining two queries selecting different columns.

SQL
SELECT id, name FROM products [1] SELECT product_id FROM sales;
Drag options to blanks, or click blank then click option'
AUNION DISTINCT
BUNION ALL
CJOIN
DUNION
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to UNION queries with different column counts causes errors.
Using JOIN instead of UNION changes the query meaning.
4fill in blank
hard

Fill both blanks to combine two queries and order the results by name.

SQL
SELECT name FROM staff [1] SELECT name FROM contractors [2] name ASC;
Drag options to blanks, or click blank then click option'
AUNION
BORDER BY
CUNION ALL
DGROUP BY
Attempts:
3 left
💡 Hint
Common Mistakes
Placing ORDER BY before UNION causes syntax errors.
Using GROUP BY instead of ORDER BY changes the result.
5fill in blank
hard

Fill all three blanks to combine two queries selecting product names and prices, including duplicates, and order by price descending.

SQL
SELECT [1], [2] FROM store1 [3] SELECT product_name, price FROM store2 ORDER BY price DESC;
Drag options to blanks, or click blank then click option'
Aproduct_name
Bprice
CUNION ALL
DUNION
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting different columns in each query causes errors.
Using UNION removes duplicates unintentionally.