MySQL – Left Join
The Left Join function in MySQL is used to retrieve records from multiple tables at the same time. The Inner Join clause can be used with a SELECT statement immediately following the FROM keyword. Left Join returns all records from the first (left-side) table, even if no matching records are found in the second (right-side) table. It returns null if it is unable to find any matches in the right hand table.
This statement returns all rows from the left table and the matched records from the right table, or Null if no matching records are found. In addition to the Left Outer Join clause, this join can also be called the Left Inward Join clause. As a result, outer is an optional keyword that can be used with Left Join.
Syntax
SELECT columns FROM table1 LEFT [OUTER] JOIN table2 ON Join_Condition;
Using the above syntax, table1 is the left-hand table, and table2 is the right-hand table. Using this clause, all records from table1 and matched records from table2 will be returned.
Example
SELECT dept_emp.emp_no FROM dept_emp LEFT JOIN employees ON dept_emp.emp_no = employees.emp_no;