SQL: a WHERE on the right table turns a LEFT JOIN into an INNER JOIN

The join produces NULLs for unmatched rows; the WHERE then evaluates those NULLs as UNKNOWN and discards them. The word LEFT is still there, doing nothing - the rows you wrote the outer join to keep are exactly the ones removed.

Full code & output

This topic is available to PRO members.

Sign in Create a free account

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-08-25