English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Usage and examples of SQL FULL OUTER JOIN keyword

SQL Keywords Reference

FULL OUTER JOIN

FULL OUTER JOIN returns all rows when there is a match in either the left or right table.

The following SQL statement selects all customers and all orders:

SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
FULL OUTER JOIN Orders
ON Customers.CustomerID=Orders.CustomerID
ORDER BY Customers.CustomerName;

Note:The FULL OUTER JOIN keyword returns all rows from the left table (Customers), and all rows from the right table (Orders). If some rows in 'Customers' do not have a match in 'Orders', or if some rows in 'Orders' do not have a match in 'Customers', these rows will also be listed.

SQL Keywords Reference