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

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 AND d.region = 'north'; return?

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

توضیح

Moving the same condition into ON makes it part of the match test rather than a filter on the result, so the two emp rows that no longer match are still emitted with null dept columns, alongside the one that matches. Answering 1 assumes ON and WHERE are interchangeable, which holds only for inner joins.

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

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