Recall & Review
beginner
What are set operations in SQL?
Set operations in SQL combine results from two or more queries into a single result. Examples include UNION, INTERSECT, and EXCEPT.
Click to reveal answer
beginner
Why do we need set operations in SQL?
Set operations help to merge, compare, or find differences between data from multiple tables or queries easily and efficiently.
Click to reveal answer
beginner
What real-life situation can explain the need for set operations?
Imagine combining guest lists from two events without duplicates (UNION), finding guests who attended both events (INTERSECT), or guests who attended only one event (EXCEPT).
Click to reveal answer
beginner
What does the UNION operation do?
UNION combines rows from two queries and removes duplicates, giving a list of all unique rows from both.
Click to reveal answer
intermediate
How does INTERSECT differ from EXCEPT?
INTERSECT returns rows common to both queries, while EXCEPT returns rows from the first query that are not in the second.
Click to reveal answer
Which SQL set operation combines results and removes duplicates?
✗ Incorrect
UNION merges results from two queries and removes duplicate rows.
Which set operation returns only rows common to both queries?
✗ Incorrect
INTERSECT returns rows that appear in both query results.
What does the EXCEPT operation do?
✗ Incorrect
EXCEPT returns rows from the first query that are not found in the second query.
Why are set operations useful in SQL?
✗ Incorrect
Set operations help combine or compare data from different queries efficiently.
Which of these is NOT a set operation in SQL?
✗ Incorrect
ORDER BY sorts results but is not a set operation.
Explain why set operations like UNION, INTERSECT, and EXCEPT are important in SQL.
Think about how you would merge or compare lists in real life.
You got /4 concepts.
Describe a real-life example where you might use SQL set operations.
Imagine managing invitations for two events.
You got /4 concepts.