Consider the following instance of a relation District – Which district names…
2024
Consider the following instance of a relation District –

Which district names will be returned by the following relational algebra expression?
πₙₐₘₑ (σₙₐₘₑ≠"AJ" (District)) − [πₙₐₘₑ (σₚₒₚᵤₗₐₜᵢₒₙ>5 (District)) ∩ πₙₐₘₑ (σₙₐₘₑ="AJ" (District))]
Answer: A. JA,MM — Concept: Selection σₙₐₘₑ(R) keeps only the tuples of relation R that satisfy the predicate; projection πₙₐₘₑ(R) then extracts just that attribute from the…
- A.
JA,MM
- B.
JA
- C.
JA,AJ
- D.
AJ
- E.
Question not attempted
Attempted by 317 students.
Show answer & explanation
Correct answer: A
Concept: Selection σₙₐₘₑ(R) keeps only the tuples of relation R that satisfy the predicate; projection πₙₐₘₑ(R) then extracts just that attribute from the surviving tuples (duplicates removed). For two such projected sets, intersection (∩) keeps tuples common to both, and set difference (A − B) keeps the tuples of A that are absent from B.
Left operand: πₙₐₘₑ (σₙₐₘₑ≠"AJ" (District)) — σₙₐₘₑ≠"AJ" keeps every row whose name is not "AJ". From District {JA:10, AJ:50, MM:5}, this is {JA, MM}. πₙₐₘₑ of this is {JA, MM}.
First factor of the bracket: πₙₐₘₑ (σₚₒₚᵤₗₐₜᵢₒₙ>5 (District)) — σₚₒₚᵤₗₐₜᵢₒₙ>5 keeps every row with population greater than 5. Both JA (10) and AJ (50) satisfy this; MM (5) does not, since 5 is not strictly greater than 5. So the selection is {JA, AJ}, and πₙₐₘₑ gives {JA, AJ}.
Second factor of the bracket: πₙₐₘₑ (σₙₐₘₑ="AJ" (District)) — σₙₐₘₑ="AJ" keeps only the row named "AJ", i.e. {AJ}. πₙₐₘₑ gives {AJ}.
Intersect the two projected sets: {JA, AJ} ∩ {AJ} = {AJ}.
Subtract from the left operand: {JA, MM} − {AJ}. Since "AJ" is not an element of {JA, MM}, removing it changes nothing, leaving {JA, MM}.
Cross-check: πₙₐₘₑ (σₙₐₘₑ="AJ" (District)) can never contain any name other than "AJ", so the bracket’s intersection is always a subset of {AJ} — at most {AJ}, never more, regardless of any population value. The left operand πₙₐₘₑ (σₙₐₘₑ≠"AJ" (District)) excludes "AJ" by construction. Subtracting a set that is at most {AJ} from a set that never contains "AJ" removes nothing, so the expression evaluates to {JA, MM} as long as AJ exists in District — independent of the exact population figures. Final result: {JA, MM}.