SQL Keyword - LEFT JOIN

LEFT JOIN Keyword

The LEFT JOIN keyword is used to combine two tables and returns all records from the left tables and only matching records from the right tables.

Syntax

SELECT * FROM <TABLE1>
LEFT JOIN <TABLE2> ON <TABLE1>.<COLUMN_NAME>=<TABLE2>.<COLUMN_NAME>

Example

SELECT * FROM Employee
LEFT JOIN Department ON Employee.Dept_Id = Department.Dept_Id

If there are no matching records in the right tables, only the left table value is displayed, and null values are substituted for the right table value.

Summary

The LEFT JOIN clause returns a result set that includes all rows from the left tables and only matching rows from the right tables.

Next Recommended Reading Top Keyword in SQL