Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to combine two tables using UNION.
MySQL
SELECT name FROM employees [1] SELECT name FROM managers; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using JOIN instead of UNION causes syntax errors.
Using WHERE does not combine result sets.
✗ Incorrect
The UNION keyword combines the results of two SELECT statements into one result set.
2fill in blank
mediumComplete the code to combine two queries and remove duplicate rows.
MySQL
SELECT city FROM customers [1] SELECT city FROM suppliers; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION ALL keeps duplicates, which is not desired here.
JOIN does not combine result sets vertically.
✗ Incorrect
UNION removes duplicate rows by default when combining result sets.
3fill in blank
hardFix the error in combining two SELECT statements to include all rows, even duplicates.
MySQL
SELECT product FROM inventory [1] SELECT product FROM warehouse; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION removes duplicates unintentionally.
JOIN does not combine result sets vertically.
✗ Incorrect
UNION ALL combines result sets including duplicates, unlike UNION which removes them.
4fill in blank
hardFill both blanks to combine two queries and sort the combined results by city.
MySQL
SELECT city FROM customers [1] SELECT city FROM suppliers [2] city ASC;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using GROUP BY instead of ORDER BY does not sort the results.
Using UNION ALL instead of UNION changes duplicate handling.
✗ Incorrect
Use UNION to combine and ORDER BY to sort the results.
5fill in blank
hardFill all three blanks to combine two SELECT queries, include duplicates, and sort by name descending.
MySQL
SELECT name FROM employees [1] SELECT name FROM contractors [2] name [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using GROUP BY instead of ORDER BY for sorting.
Using UNION instead of UNION ALL removes duplicates.
✗ Incorrect
UNION ALL includes duplicates, ORDER BY sorts, and DESC sorts descending.