Joins allow us to combine data from multiple tables based on a common column, helping retrieve meaningful results efficiently. MySQL supports INNER JOIN, LEFT JOIN, RIGHT JOIN, CROSS JOIN, and FULL OUTER JOIN(simulated using UNION).
The UNION and UNION ALL operators merge result sets from multiple queries, with UNION removing duplicates and UNION ALL keeping them.
This quiz will test your understanding of MySQL joins and unions.
1.
Which MySQL function is useful in joins to handle NULL values?
2.
Which type of join can result in a Cartesian product?
3.
What is the purpose of the ON clause in a JOIN statement?
4.
What is the difference between UNION and UNION ALL?
5.
What will a LEFT JOIN return if there are no matching records in the right table?
6.
Which join includes all records from the right table and only matching records from the left table?
7.
What does the USING clause do in a JOIN?
8.
What happens if you perform a RIGHT JOIN and there are no matching records in the left table?
9.
Which statement correctly performs an INNER JOIN between two tables named 'customers' and 'orders'?
10.
How can you combine two result sets that have the same structure but remove duplicate rows?
11.
Which SQL operator is used to combine the results of multiple SELECT queries?
12.
How can you retrieve only matching records from two tables, ensuring no duplicate records appear in the final result set?
14.
What does a CROSS JOIN do?
15.
Which type of join returns only matching rows from both tables?
16.
Which SQL keyword is used to perform a full outer join in MySQL?
17.
What is the primary purpose of using joins in MySQL?