- Basic Concept
- SQL JOIN combines data from two or more tables into a single output table
- JOIN condition specifies how rows from tables are combined
- JOIN is used in nearly every second SQL query
- Types of OUTER JOIN
- LEFT OUTER JOIN returns all rows from left table with NULL values for unmatched right table rows
- RIGHT OUTER JOIN returns all rows from right table with NULL values for unmatched left table rows
- FULL OUTER JOIN returns all rows from both tables with NULL values for unmatched values
- Key Differences
- INNER JOIN returns only matching rows between tables
- OUTER JOIN includes unmatched rows in results
- OUTER keyword is optional in all types
- LEFT OUTER JOIN can be used interchangeably with LEFT JOIN
- RIGHT OUTER JOIN can be used interchangeably with RIGHT JOIN
- FULL OUTER JOIN can be used interchangeably with FULL JOIN