Recall & Review
beginner
What does the SQL INTERSECT operator do?
It returns only the rows that appear in both of two SELECT query results.
Click to reveal answer
intermediate
Why does MySQL not support the INTERSECT operator directly?
MySQL does not have built-in INTERSECT support, so you must use alternative methods like INNER JOIN or EXISTS to get the same result.
Click to reveal answer
intermediate
How can you simulate INTERSECT in MySQL using INNER JOIN?
Use INNER JOIN between two SELECT queries on all columns to return only rows common to both queries.
Click to reveal answer
beginner
Write a simple MySQL query to simulate INTERSECT between two tables A and B on column 'id'.
SELECT A.id FROM A INNER JOIN B ON A.id = B.id;
Click to reveal answer
intermediate
What is an alternative to INNER JOIN for INTERSECT equivalent in MySQL?
You can use EXISTS with a correlated subquery to check if a row from the first query exists in the second.
Click to reveal answer
Which MySQL clause can simulate INTERSECT by returning rows common to two queries?
✗ Incorrect
INNER JOIN returns rows that exist in both tables, simulating INTERSECT.
What does the EXISTS clause do in MySQL when used for INTERSECT equivalent?
✗ Incorrect
EXISTS checks for the presence of matching rows, helping simulate INTERSECT.
Why can't you use INTERSECT directly in MySQL?
✗ Incorrect
MySQL lacks native INTERSECT support, so alternatives are needed.
Which SQL operator returns all rows from both queries without duplicates?
✗ Incorrect
UNION combines rows from both queries and removes duplicates.
In MySQL, what must be true about columns when simulating INTERSECT with INNER JOIN?
✗ Incorrect
Columns used in the join must match to correctly find common rows.
Explain how to simulate the INTERSECT operator in MySQL and why it is necessary.
Think about how to find rows that appear in both tables.
You got /3 concepts.
Describe the difference between UNION and INTERSECT and how to achieve INTERSECT behavior in MySQL.
Focus on what rows each operator returns.
You got /3 concepts.