Which operation is used to get tuples which are in the first table, but not in the second table?
Which operation is used to get tuples which are in the first table, but not in the second table?
Solution
MINUS (set difference, written in relational algebra) returns the tuples present in the first table but absent from the second. In SQL it is written as MINUS in Oracle and EXCEPT in standard SQL and others.
INTERSECT: returns only the tuples common to both tables, not those exclusive to the first.
UNION: returns all tuples from both tables, with duplicates removed.
CARTESIAN PRODUCT: pairs every tuple of the first table with every tuple of the second, so it does not compare tuples for presence or absence.
Set difference is not commutative: in general.
Related questions:
2025: 20 May Shift 1
2025: 20 May Shift 1
2025: 22 May Shift 1
2026: 21 May Shift 1