QuestenaPractice that shows what to review next
Question 3

In PostgreSQL 18, SELECT NULL IS DISTINCT FROM NULL, 1 IS DISTINCT FROM NULL; returns two values. Which pair is correct?

  1. false and NULL
  2. NULL and NULL
  3. false and trueCorrect answer
  4. true and true

Explanation

IS DISTINCT FROM is a total comparison that never returns null: two nulls count as not distinct (false), and a null against a non-null counts as distinct (true). This is exactly the pair of cases that the plain <> operator answers with null.

Continue with this test

Start practice
Question 3: In PostgreSQL 18, SELECT NULL IS DISTINCT FROM NULL, 1 IS… · SQL: NULL, Joins and Aggregates · Questena