SQL Server Interview Question #63

What is a LEFT JOIN?

Joins, Subqueries, CTEs & Set Operators Mid-Level Intermediate

Detailed Explanation

LEFT JOIN, also called LEFT OUTER JOIN, returns every row from the left table and matching rows from the right table. When no right-side match exists, columns from the right side are returned as NULL.

It is commonly used to find parent records even when optional related data does not exist.

Code Example

SELECT c.Id, c.Name, p.Name AS ProductName
FROM dbo.Categories AS c
LEFT JOIN dbo.Products AS p
    ON p.CategoryId = c.Id;