LEFT JOIN (often written as LEFT OUTER JOIN) is a relational operation that combines two tables. It keeps all rows from the table listed before the LEFT JOIN keyword (the left table). For each left-table row, the database searches the right table for rows that satisfy the join condition. When a match is found, columns from the right table are returned; when no match exists, the right-table columns are filled with NULLs. This makes LEFT JOIN ideal for retaining unmatched rows while still pulling any related data that does exist.Key points:- The result set size is always at least the number of rows in the left table.- Rows that do not satisfy the ON condition in the right table produce NULLs in right-table columns.- Adding filters in the WHERE clause that reference right-table columns can accidentally convert a LEFT JOIN to an INNER JOIN by removing NULL rows; use IS NULL checks instead.- LEFT JOIN obeys standard SQL evaluation order: FROM and JOINs first, then WHERE, then GROUP BY, HAVING, and SELECT.
- left_table
(table) - The primary table whose rows are all preserved.- right_table
(table) - The secondary table from which matching rows are pulled.- join_condition
(expression) - Boolean expression that defines how rows relate, usually using equality on key columns.INNER JOIN, RIGHT JOIN, FULL JOIN, CROSS JOIN, JOIN ON, NULL handling, OUTER JOIN
SQL-92
An INNER JOIN shows only rows that meet the join condition in both tables. LEFT JOIN preserves every row from the left table and inserts NULLs for right-table columns when no match exists.
Yes. Write additional LEFT JOIN clauses, each with its own ON condition, to pull optional data from several related tables.
Without an ON clause, the database performs a Cartesian product of the two tables and then applies WHERE filters. This is almost never desired and can create huge result sets.
Rows where right-table columns are NULL survive the join. To keep those rows while filtering, use WHERE right_table.column IS NULL instead of equality checks.