CS FundamentalsModerateCapgemini · Cognizant GenC

Dept(d) has rows 1, 2, 3 and Emp(e, d) has rows (a, 1), (b, 1), (c, 2). How many rows does SELECT D.d FROM Dept D LEFT JOIN Emp E ON D.d = E.d return?

  1. A. 3
  2. B. 5
  3. C. 4
  4. D. 6

Correct answer: C. 4

Dept 1 matches twice, dept 2 once and dept 3 has no match but is kept with NULLs: 2 + 1 + 1 = 4 rows.

More DBMS and SQL questions

Exams that ask this topic