1/22/25, 5:52 PM SQL FULL OUTER JOIN Keyword
Tutorials Exercises Certificates Services Search... Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP R
SQL FULL OUTER JOIN Keyword
❮ Previous Next ❯
SQL FULL OUTER JOIN Keyword
The FULL OUTER JOIN keyword returns all records when there is a match in left (table1) or right (table2) table records.
Tip: FULL OUTER JOIN and FULL JOIN are the same.
FULL OUTER JOIN Syntax
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
https://www.w3schools.com/sql/sql_join_full.asp 1/8
1/22/25, 5:52 PM SQL FULL OUTER JOIN Keyword
ON table1.column_name = table2.column_name
WHERE Tutorials
condition; Exercises Certificates Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP R
Note: FULL OUTER JOIN can potentially return very large result-sets!
Demo Database
In this tutorial we will use the well-known Northwind sample database.
Below is a selection from the "Customers" table:
CustomerID CustomerName ContactName Address City PostalCode Country
1 Alfreds Futterkiste Maria Anders Obere Str. 57 Berlin 12209 Germany
2 Ana Trujillo Ana Trujillo Avda. de la México 05021 Mexico
Emparedados y Constitución 2222 D.F.
helados
https://www.w3schools.com/sql/sql_join_full.asp 2/8
1/22/25, 5:52 PM SQL FULL OUTER JOIN Keyword
3 Tutorials
Antonio Moreno
Exercises
Taquería
Antonio
Certificates
Moreno
Services
Mataderos 2312 México 05023
D.F.
Mexico
Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP R
And a selection from the "Orders" table:
OrderID CustomerID EmployeeID OrderDate ShipperID
10308 2 7 1996-09-18 3
10309 37 3 1996-09-19 1
10310 77 8 1996-09-20 2
SQL FULL OUTER JOIN Example
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;
A selection from the result set may look like this:
https://www.w3schools.com/sql/sql_join_full.asp 3/8
1/22/25, 5:52 PM SQL FULL OUTER JOIN Keyword
CustomerName
Tutorials Exercises Certificates Services
OrderID
Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP R
Null 10309
Null 10310
Alfreds Futterkiste Null
Ana Trujillo Emparedados y helados 10308
Antonio Moreno Taquería Null
Note: The FULL OUTER JOIN keyword returns all matching records from both tables whether the other table matches or
not. So, if there are rows in "Customers" that do not have matches in "Orders", or if there are rows in "Orders" that do
not have matches in "Customers", those rows will be listed as well.
?
Exercise
What does the SQL FULL OUTER JOIN keyword do?
Returns all records when there is a match in the left or right table
Returns all records from the left table and matching records from the right table
Returns all records from the right table and matching records from the left table
https://www.w3schools.com/sql/sql_join_full.asp 4/8
1/22/25, 5:52 PM SQL FULL OUTER JOIN Keyword
Tutorials Exercises Certificates Services
Submit Answer »
Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP R
❮ Previous Next ❯
Track your progress - it's free! Sign Up Log in
https://www.w3schools.com/sql/sql_join_full.asp 5/8
1/22/25, 5:52 PM SQL FULL OUTER JOIN Keyword
Tutorials Exercises Certificates Services Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP R
COLOR PICKER
https://www.w3schools.com/sql/sql_join_full.asp 6/8
1/22/25, 5:52 PM SQL FULL OUTER JOIN Keyword
Tutorials Exercises Certificates Services Sign Up Log in
HTML
CSS
JAVASCRIPT
PLUS
SQL
SPACES
PYTHON JAVA
GET CERTIFIED
PHP HOW TO
FOR TEACHERS
W3.CSS C C++ C# BOOTSTRAP R
FOR BUSINESS CONTACT US
Top Tutorials Top References
HTML Tutorial HTML Reference
CSS Tutorial CSS Reference
JavaScript Tutorial JavaScript Reference
How To Tutorial SQL Reference
SQL Tutorial Python Reference
Python Tutorial W3.CSS Reference
W3.CSS Tutorial Bootstrap Reference
Bootstrap Tutorial PHP Reference
PHP Tutorial HTML Colors
Java Tutorial Java Reference
C++ Tutorial Angular Reference
jQuery Tutorial jQuery Reference
Top Examples Get Certified
HTML Examples HTML Certificate
CSS Examples CSS Certificate
JavaScript Examples JavaScript Certificate
How To Examples Front End Certificate
SQL Examples SQL Certificate
Python Examples Python Certificate
W3.CSS Examples PHP Certificate
Bootstrap Examples jQuery Certificate
PHP Examples Java Certificate
Java Examples C++ Certificate
XML Examples C# Certificate
jQuery Examples XML Certificate
https://www.w3schools.com/sql/sql_join_full.asp 7/8
1/22/25, 5:52 PM SQL FULL OUTER JOIN Keyword
Tutorials Exercises Certificates Services Sign Up Log in
HTML
CSS JAVASCRIPT
SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP R
FORUM ABOUT ACADEMY
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy
policy.
Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.
https://www.w3schools.com/sql/sql_join_full.asp 8/8