Create a join in a SELECT statement to retrieve data from two or more tables based on matching column values.
A join enables you to select data from two or more tables into a single results set without repeating unnecessary data. You can create different kinds of joins depending on what data from each table you want in the results set.
Join operator | Description |
---|---|
Inner join | Returns data from all tables based on a common condition. |
Left outer join | Returns all the values from the left table plus matched values from the right table, and fills in NULLs for any missing values from the right table. |
Right outer join | Returns all the values from the right table and matched values from the left table, and fills in NULLs for any missing values from the left table. |
Full outer join | Combines the results of both left and right outer joins. The joined table contains all records from both tables, and fills in NULLs for missing matches on either side. |