programplug Logo



SQL Left Joins

Left Joins In SQL


Left join return all the rows from the right table and compare with the rows od right table.If there is no matching Value found it return NULL. Syntax
SELECT tab1.col1, tab2.col2...
FROM tab1
LEFT JOIN tab2
ON tab1.common_field = tab2.common_field;
Tab 1
E_id E_NAME E_Age
501 Mike 42
502 Robert 34
503 KARL 32
504 Benn 39
Tab 2
P_Id P_Date E_SALARY
501 05-03-2018 15400
502 05-03-2018 14200
503 05-03-2018 16000
504 05-03-2018 17500
Result After execution
P_id E_name
501 Mike
502 Robert
503 KARL
504 Benn