QuestenaPractice that shows what to review next
Question 19

In PostgreSQL 18, a group of three rows holds v values 1, NULL and 2. What do avg(v) and sum(v) return for that group?

  1. 1.5 and NULL
  2. 1 and 3
  3. 1.5 and 3Correct answer
  4. NULL and NULL

Explanation

Both aggregates ignore the null: sum adds 1 and 2, and avg divides that 3 by 2 rather than by 3. Answering 1 and 3 assumes the null contributes a row to the divisor, which is what sum(v) / count(*) would compute.

Continue with this test

Start practice
Question 19: In PostgreSQL 18, a group of three rows holds v values 1,… · SQL: NULL, Joins and Aggregates · Questena