0
0
MySQLquery~10 mins

Why combining result sets is useful in MySQL - Test Your Understanding

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

Complete 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'
AWHERE
BUNION
CINTERSECT
DJOIN
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 and remove duplicate rows.

MySQL
SELECT city FROM customers [1] SELECT city FROM suppliers;
Drag options to blanks, or click blank then click option'
AUNION ALL
BJOIN
CUNION
DEXCEPT
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION ALL keeps duplicates, which is not desired here.
JOIN does not combine result sets vertically.
3fill in blank
hard

Fix 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'
AUNION ALL
BJOIN
CINTERSECT
DUNION
Attempts:
3 left
💡 Hint
Common Mistakes
Using UNION removes duplicates unintentionally.
JOIN does not combine result sets vertically.
4fill in blank
hard

Fill 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'
AUNION
BORDER BY
CUNION ALL
DGROUP BY
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.
5fill in blank
hard

Fill 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'
AUNION ALL
BORDER BY
CDESC
DGROUP BY
Attempts:
3 left
💡 Hint
Common Mistakes
Using GROUP BY instead of ORDER BY for sorting.
Using UNION instead of UNION ALL removes duplicates.