Recall & Review
beginner
What does the SQL EXCEPT operator do?
It returns rows from the first query that are not present in the second query.
Click to reveal answer
beginner
Does MySQL support the EXCEPT operator directly?
No, MySQL does not support EXCEPT directly. You can use LEFT JOIN or NOT EXISTS to get the same result.
Click to reveal answer
intermediate
How can you simulate EXCEPT in MySQL using LEFT JOIN?
Select rows from the first table and LEFT JOIN the second table on matching columns, then filter where the second table's columns are NULL.
Click to reveal answer
intermediate
Write a simple NOT EXISTS query to simulate EXCEPT in MySQL.
SELECT * FROM table1 t1 WHERE NOT EXISTS (SELECT 1 FROM table2 t2 WHERE t2.col = t1.col);
Click to reveal answer
advanced
Why might you choose NOT EXISTS over LEFT JOIN to simulate EXCEPT?
NOT EXISTS can be more readable and sometimes more efficient, especially when dealing with NULL values or complex conditions.
Click to reveal answer
Which SQL operator returns rows from the first query that are not in the second?
✗ Incorrect
EXCEPT returns rows from the first query that do not appear in the second.
Does MySQL support the EXCEPT operator natively?
✗ Incorrect
MySQL does not support EXCEPT natively; alternatives like LEFT JOIN or NOT EXISTS are used.
Which SQL clause can simulate EXCEPT by filtering unmatched rows?
✗ Incorrect
LEFT JOIN combined with IS NULL filters rows not matched in the second table, simulating EXCEPT.
What does NOT EXISTS do in a query?
✗ Incorrect
NOT EXISTS returns true if the subquery returns no rows, useful to exclude matches.
Which method can handle NULL values better when simulating EXCEPT?
✗ Incorrect
NOT EXISTS handles NULL values more reliably than LEFT JOIN with IS NULL in some cases.
Explain how to simulate the EXCEPT operator in MySQL using LEFT JOIN.
Think about joining and then filtering unmatched rows.
You got /3 concepts.
Describe the difference between using NOT EXISTS and LEFT JOIN to simulate EXCEPT in MySQL.
Consider readability and how NULL values affect results.
You got /3 concepts.