Questenaتمرینی که نشان می‌دهد بعد چه چیزی را مرور کنید
سؤال 9

In PostgreSQL 18, table emp has 3 rows with dept_id values 10, 20 and NULL, and table dept has 2 rows: (id 10, region 'north') and (id 20, region 'south'). How many rows does SELECT * FROM emp e LEFT JOIN dept d ON d.id = e.dept_id WHERE d.region = 'north'; return?

  1. 1پاسخ درست
  2. 3
  3. 2
  4. 0

توضیح

The WHERE clause is applied after the join, and for every null-extended left row d.region is null, so the condition is not true and the row is discarded - the LEFT JOIN silently degrades into an inner join. Answering 3 assumes a LEFT JOIN always preserves every left row, which the join itself does but the later filter undoes.

ادامهٔ این آزمون

شروع تمرین
سؤال 9: In PostgreSQL 18, table emp has 3 rows with dept_id values… · SQL: NULL, Joins and Aggregates · Questena