QuestenaПрактика, после которой понятно, что повторить
Вопрос 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 NULLПравильный ответ
  2. No rows at all
  3. One row containing 0 and 0
  4. One row containing NULL and NULL

Объяснение

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.

Продолжить работу с тестом

Начать тренировку
Вопрос 17: In PostgreSQL 18, what does SELECT count(*), sum(v) FROM m… · SQL: NULL, Joins and Aggregates · Questena