Questenaتدريب يوضح لك ما ينبغي مراجعته لاحقًا
السؤال 4

In PostgreSQL 18, what does SELECT NULL IN (SELECT 1 WHERE false); return, given that the subquery produces no rows?

  1. It raises an error
  2. true
  3. NULL
  4. falseالإجابة الصحيحة

الشرح

IN over a subquery is false when no equal row is found, and that includes the case where the subquery returns nothing at all: with zero rows on the right, no comparison is ever performed, so nothing can be unknown. NULL is the tempting answer because a null left-hand side normally poisons the result, and it does as soon as the subquery returns a row: SELECT NULL IN (SELECT 1); returns NULL.

تابع هذا الاختبار

بدء التدريب