SQL FULL OUTER JOIN Keyword
The FULL OUTER JOIN command is used to return all rows from both tables. If there is no match, the result will contain NULL on the side where there is no match.
SQL FULL OUTER JOIN Syntax
SQL
x
1
SELECT column_names
2
FROM table1
3
FULL OUTER JOIN table2
4
ON table1.column_name = table2.column_name;
SQL FULL OUTER JOIN Customers and Orders Example
This query selects all customers and all orders. Where there is no match, NULL values will fill in the missing side.
SQL
1
1
SELECT Customers.CustomerName, Orders.OrderID
2
FROM Customers
3
FULL OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID
4
ORDER BY Customers.CustomerName;
Note: The
FULL OUTER JOIN
keyword returns all records from both tables. If there is no match, missing values will appear asNULL
.
Important:
FULL OUTER JOIN
is not supported in SQLite and therefore will not work in the TechKubo playground. UseLEFT JOIN
,RIGHT JOIN
, or simulate withUNION
if needed.