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?
Explanation
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.