Consider the following two tables 'SPORTSSTUDENTS' and 'MUSICSTUDENTS'.
SPORTSSTUDENTS
Name Email Amit [email protected] Anil [email protected]
MUSICSTUDENTS
Name Email Amit [email protected] Vimal [email protected]
What is the result of 'SPORTSSTUDENTS' - 'MUSICSTUDENTS' operation?
Consider the following two tables 'SPORTSSTUDENTS' and 'MUSICSTUDENTS'.
SPORTSSTUDENTS
| Name | |
|---|---|
| Amit | [email protected] |
| Anil | [email protected] |
MUSICSTUDENTS
| Name | |
|---|---|
| Amit | [email protected] |
| Vimal | [email protected] |
What is the result of 'SPORTSSTUDENTS' - 'MUSICSTUDENTS' operation?
Solution
The difference operation returns the rows that are in but not in . Amit's row appears in both tables, so it is removed. Anil's row appears only in SPORTSSTUDENTS, so it stays.
| Name | |
|---|---|
| Anil | [email protected] |
Option 2: this is the intersection of the two tables (rows common to both), not the difference.
Option 3: this is the result of the reverse operation, 'MUSICSTUDENTS' - 'SPORTSSTUDENTS'.
Option 4: this is just the original SPORTSSTUDENTS table, with nothing removed.
Set difference is not commutative, so in general.
Related questions:
2025: 30 May Shift 2
2026: 23 May Shift 1
2026: 29 May Shift 2
2025: 16 May Shift 1