LEFT JOIN

Syntax:

SELECT...FROM table_reference1
  LEFT JOIN table_reference2 join_condition
					

Description: Performs a left join as part of a SELECT statement. A left join is a join in which all rows in the left table table_reference1 are returned (subject to any WHERE condition); wherever these rows match with rows of table_reference2 through a join_condition, values from the right table appear in the resultset, or NULL otherwise.

table_reference either is a table name or uses an alias to that table, in the format table_name AS alias_name.

join_condition defines the relationship used in the join and is either ON conditional_expression or USING (column_list).

Description in: Day 9

See also: CROSS JOIN, INNER JOIN, LEFT JOIN, NATURAL LEFT JOIN

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.