QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 8

In PostgreSQL 18, SELECT x FROM (VALUES (1),(NULL),(2)) AS v(x) ORDER BY x DESC; is run with no NULLS FIRST or NULLS LAST clause. Which value appears in the first row?

  1. The position of NULL is unspecified
  2. 2
  3. 1
  4. NULLՃիշտ պատասխան

Բացատրություն

The default is to sort as though nulls were larger than every non-null value, which makes NULLS FIRST the default for DESC and NULLS LAST the default for ASC. Answering 2 comes from carrying over the ASC behaviour, where the null does come last.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 8: In PostgreSQL 18, SELECT x FROM (VALUES (1),(NULL),(2)) AS… · SQL: NULL, Joins and Aggregates · Questena