QuestenaÜben und erkennen, was als Nächstes dran ist
Frage 13

In PostgreSQL 18, table emp has 3 rows with dept_id values 10, 20 and NULL, and table dept_null has exactly one row whose id is NULL. How many rows does SELECT * FROM emp e JOIN dept_null d ON d.id = e.dept_id; return?

  1. 0Richtige Antwort
  2. 3
  3. 1
  4. 2

Erklärung

A pair of rows matches only when the ON expression evaluates to true, and NULL = NULL evaluates to null, so the null dept_id never pairs with the null id. Answering 1 reads the join as matching identical values; writing ON d.id IS NOT DISTINCT FROM e.dept_id is what produces that row.

Mit diesem Test weitermachen

Übung starten
Frage 13: In PostgreSQL 18, table emp has 3 rows with dept_id values… · SQL: NULL, Joins and Aggregates · Questena