QuestenaPractice that shows what to review next
Question 16

In PostgreSQL 18, table m has 4 rows and its column v holds the values 1, NULL, 2 and NULL. What does SELECT count(*), count(v), count(DISTINCT v) FROM m; return?

  1. 4, 4, 2
  2. 4, 2, 3
  3. 2, 2, 2
  4. 4, 2, 2Correct answer

Explanation

count(*) counts input rows regardless of content, while count(v) counts only rows where v is not null, and count(DISTINCT v) counts distinct non-null values. The answer 3 comes from expecting NULL to be counted as one more distinct value.

Continue with this test

Start practice
Question 16: In PostgreSQL 18, table m has 4 rows and its column v holds… · SQL: NULL, Joins and Aggregates · Questena