Recall & Review
beginner
What does the SQL INTERSECT operator do?
The INTERSECT operator returns only the rows that appear in both query results. It shows common rows between two SELECT statements.
Click to reveal answer
beginner
What is the purpose of the EXCEPT operator in SQL?
The EXCEPT operator returns rows from the first query that are not present in the second query. It shows what is unique to the first SELECT statement.
Click to reveal answer
intermediate
Can INTERSECT and EXCEPT be used with different numbers of columns in the SELECT statements?
No. Both SELECT statements must have the same number of columns with compatible data types for INTERSECT and EXCEPT to work.
Click to reveal answer
intermediate
How does INTERSECT differ from JOIN in SQL?
INTERSECT returns rows common to both queries as whole rows, while JOIN combines rows based on matching column values, often producing more columns.
Click to reveal answer
beginner
If you want to find customers who bought product A but not product B, which operator would you use?
You would use the EXCEPT operator to find customers in the product A list who are not in the product B list.
Click to reveal answer
What does the INTERSECT operator return?
✗ Incorrect
INTERSECT returns only the rows that appear in both SELECT query results.
Which 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 query.
Can INTERSECT be used if the two SELECT statements have different numbers of columns?
✗ Incorrect
Both SELECT statements must have the same number of columns with compatible data types for INTERSECT.
Which SQL operator would you use to find rows unique to the first query?
✗ Incorrect
EXCEPT returns rows from the first query that are not in the second query.
What is a key difference between INTERSECT and JOIN?
✗ Incorrect
INTERSECT returns rows common to both queries as whole rows, JOIN combines rows based on matching column values.
Explain how the INTERSECT operator works in SQL and give a simple example.
Think about finding common friends in two friend lists.
You got /3 concepts.
Describe the EXCEPT operator and when you would use it.
Imagine subtracting one list from another.
You got /3 concepts.