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.
What happens if you perform a RIGHT JOIN and there are no matching records in the left table?
2.
What is the purpose of the ON clause in a JOIN statement?
3.
What does a CROSS JOIN do?
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.
What does the USING clause do in a JOIN?
7.
What is the primary purpose of using joins in MySQL?
8.
Which statement correctly performs an INNER JOIN between two tables named 'customers' and 'orders'?
9.
Which type of join can result in a Cartesian product?
10.
Which MySQL function is useful in joins to handle NULL values?
11.
Which join includes all records from the right table and only matching records from the left table?
12.
Which type of join returns only matching rows from both tables?
14.
How can you retrieve only matching records from two tables, ensuring no duplicate records appear in the final result set?
15.
Which SQL keyword is used to perform a full outer join in MySQL?
16.
How can you combine two result sets that have the same structure but remove duplicate rows?
17.
Which SQL operator is used to combine the results of multiple SELECT queries?