QuestenaPráctica que te muestra qué repasar después
Pregunta 17

In PostgreSQL 18, what does SELECT count(*), sum(v) FROM m WHERE false; return, given that the WHERE clause removes every row?

  1. One row containing 0 and NULLRespuesta correcta
  2. No rows at all
  3. One row containing 0 and 0
  4. One row containing NULL and NULL

Explicación

An aggregate query without GROUP BY always yields exactly one row, and count is the exception that returns 0 over an empty input while the other aggregates return null. Expecting 0 and 0 is the classic cause of a null slipping into a total; coalesce(sum(v), 0) is the usual guard.

Continúa con este test

Empezar la práctica
Pregunta 17: In PostgreSQL 18, what does SELECT count(*), sum(v) FROM m… · SQL: NULL, Joins and Aggregates · Questena