14.2 Joining Multiple Tables
In SQL, JOIN clauses are used to combine rows from two or more tables based on a related column between them. There are various types of JOINs available in SQL:
- (INNER) JOIN: Returns records that have matching values in both tables.
- LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table.
- RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table.
- FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table.
INNER JOIN Keyword
The INNER JOIN keyword is used to combine data from two different tables using a common column. This is particularly useful when we want to retrieve data that exists in both tables. By using the INNER JOIN keyword, we can ensure that only the records with matching values in both tables are returned.
This can help us to better understand the relationships between different pieces of data and to gain...