The LEFT JOIN returns all record from the left table (table_1), with the matching record in the right table (table_2). The result is NULL in the right side when there is no match.
Syntax:
OR
As you see,In this tutorial we have two tables like this table(1) "Departments" and table(2) "Employee".
Table 1(Departments):
Example:
Output:
Syntax:
SELECT *
FROM table_1
LEFT OUTER JOIN table_2
ON table_1.column_some_name=table_2.column_name
FROM table_1
LEFT OUTER JOIN table_2
ON table_1.column_some_name=table_2.column_name
OR
SELECT *
FROM table_1
LEFT JOIN table_2
ON table_1.column_some_name=table_2.column_name
FROM table_1
LEFT JOIN table_2
ON table_1.column_some_name=table_2.column_name
As you see,In this tutorial we have two tables like this table(1) "Departments" and table(2) "Employee".
Table 1(Departments):
Table 2(Employee):
Example:
SELECT * FROM Departments e1 LEFT OUTER JOIN Employee e2
ON e2.DepartID = e1.id
ON e2.DepartID = e1.id
Output:
Post a Comment