CS FundamentalsHardProduct-company placement

Player(pid, team, runs) has rows (1, 'A', 50), (2, 'A', 70), (3, 'A', 70), (4, 'B', 40), (5, 'B', NULL), (6, 'B', 90), (7, 'C', NULL). What does this return? SELECT team, MAX(runs) FROM Player GROUP BY team HAVING COUNT(runs) < COUNT(*);

  1. A. Two rows: (B, 90) and (C, NULL)
  2. B. One row: (B, 90)
  3. C. Two rows: (B, NULL) and (C, NULL)
  4. D. No rows

Correct answer: A. Two rows: (B, 90) and (C, NULL)

COUNT(runs) skips NULLs, so the condition picks teams with at least one NULL: B (2 < 3) and C (0 < 1). MAX ignores NULLs, giving 90 for B and NULL for C, whose only value is NULL.

More DBMS and SQL questions

Exams that ask this topic