QuestenaPráctica que te muestra qué repasar después
Pregunta 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. 0Respuesta correcta
  2. 3
  3. 1
  4. 2

Explicación

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.

Continúa con este test

Empezar la práctica
Pregunta 13: In PostgreSQL 18, table emp has 3 rows with dept_id values… · SQL: NULL, Joins and Aggregates · Questena