SQL & Queries

Answer & solution
Answer: B (no official key was published)
1. Query2 and Query4 each scan paid, whose student key is unique, and keep exactly students with an enrolled match. They therefore return identical bags with one row per matching student.
2. Query1 scans enrolled and returns one student occurrence for each matching enrollment; Query3 has the same multiplicities because paid has at most one matching row. A paid student enrolled in two courses appears twice in Query1/3 but once in Query2/4.
3. Thus B. SELECT alone does not eliminate duplicate rows; the phrase row sets must be interpreted as SQL result rows/bags.
4. Teaching check: A membership predicate filters each outer row but does not collapse duplicates already present in the outer projection. The paid key guarantees one outer row per student for Q2/Q4, whereas enrolled can contain several courses per student for Q1/Q3. Relational set intuition must not erase SQL multiplicities.