Page 178 - IT-802_class_12
P. 178
WHERE,
table1: First table.
table2: Second table
matching column: Column common to both the tables.
Notes
We can also write JOIN instead of INNER JOIN. Both are the same.
Table A Table B
Example:
SELECT EmpLOyEE.Emp_iD, EmpLOyEE.SALARy
FROm EmpLOyEE
NNER JOiN EmpLOyEE_DETAiLS
ON EmpLOyEE.Emp_iD = EmpLOyEE_DETAiLS.Emp_iD;
Output:
+--------+--------+
| Emp_iD | SALARy |
+--------+--------+
| 03 | 18000 |
| 04 | 25000 |
| 06 | 28000 |
+--------+--------+
1.12.2 Left Join
This join returns all the rows of the table on the left side of the join and matches rows for the table on the right side of
the join. For the rows for which there is no matching row on the right side, the result-set will contain null. LEFT JOIN is
also known as LEFT OUTER JOIN.
Syntax:
SELECT table1.column1, table1.column2, table2.column1, ....
FROm table1
LEFT JOiN table2
ON table1.matching_column = table2.matching_column;
WHERE,
table1: First table.
table2: Second table
matching_column: Column common to both the tables.
176 Touchpad Information Technology-XII

