Bird
0
0

Given two tables:

medium📝 query result Q4 of 15
SQL - Set Operations
Given two tables:
table1:
id
1
2
3

table2:
id
2
3
4

What is the result of:
SELECT id FROM table1 EXCEPT SELECT id FROM table2;
A1
B4
C2, 3
D1, 4
Step-by-Step Solution
Solution:
  1. Step 1: Identify rows in table1

    table1 has ids 1, 2, 3.
  2. Step 2: Identify rows in table2

    table2 has ids 2, 3, 4.
  3. Step 3: Find rows in table1 not in table2

    Only id 1 is in table1 but not in table2.
  4. Final Answer:

    1 -> Option A
  5. Quick Check:

    EXCEPT returns unique rows from first query not in second [OK]
Quick Trick: EXCEPT returns rows only in first table [OK]
Common Mistakes:
MISTAKES
  • Including rows from second table
  • Confusing EXCEPT with INTERSECT
  • Listing all unique ids from both tables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes