Left Join
In LEFT JOIN if all records of LEFT table are returuned by matching RIGHT table.
If RIGHT table is not matched the 'NULL' (no value) return.
Left Join |
Syntax :-
SELECT table1.column_name, table.2column_name
FROM table_name1 LEFT JOIN table_name2
ON table1.common_field = table1.common_field;
Example : figure in below, we have, two tables customers and orders.
Now, let see join these two tables using the LEFT JOIN as follows.
Query :
Output :
SELECT Id, Name, Address
FROM customers LEFT JOIN orders
ON customers.Id = orders.customers_Id;
0 Comments