|
Answer» In SQL, join STATEMENTS combine data from multiple tables BASED on a common field between them. Any time there are two or more tables listed in a SQL statement, a SQL JOIN is performed. Among the DIFFERENT types of joins are: - INNER JOIN: It will return records that have the same value in both tables. In this case, it would return records where TABLE1 and table2 intersect. Below is a visual representation of the same.
- LEFT (Outer) JOIN: It will return all records from the left-hand table, along with matched records from the right-hand table. It would return all records from table1 (left-hand table) and only those records from table2 (right-hand table) that intersect with table1. Below is a visual representation of the same.
- RIGHT (Outer) JOIN: It will return all records from the right-hand table, along with matched records from the left-hand table. It would return all records from table2 (right-hand table) and only those records from table1 (left-hand table) that intersect with table2. Below is a visual representation of the same.
- FULL (Outer) JOIN: It will return all records from both left-hand and right-hand tables. It would return all rows from both the left-hand table (table1) and right-hand table (table2) with NULL values in place wherever the join condition is not satisfied. Below is a visual representation of the same.
|