CS FundamentalsHardGATE CS

T(g, x) holds (a, 1), (NULL, 2), (a, 3), (NULL, 4), (b, 5). How many rows does SELECT g, COUNT(*) FROM T GROUP BY g return?

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

Correct answer: B. 3

GROUP BY places all NULLs in one group, so the groups are a, b and NULL: 3 rows.

More DBMS and SQL questions

Exams that ask this topic