intermediateJOINs — INNER, LEFT, RIGHT, FULL, SELF, CROSS

A LEFT JOIN is unexpectedly returning the same results as INNER JOIN. Why?

The most common cause: a WHERE clause filtering on a column from the right table. Example: SELECT * FROM employees e LEFT JOIN departments d ON e.dept_id = d.dept_id WHERE d.dept_name = 'Engineering'. If dept_name is NULL (no match), the WHERE condition fails → that row is excluded. Solution: move the filter to the ON clause: LEFT JOIN departments d ON e.dept_id = d.dept_id AND d.dept_name = 'Engi

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.

A LEFT JOIN is unexpectedly returning the same results as INNER JOIN. Why?

Next Step

Continue to When would you use a SELF JOIN vs a CTE?← Back to all SQL questions