# SQL FULL OUTER JOIN Keyword

### SQL FULL OUTER JOIN Keyword

The FULL OUTER JOIN keyword return all records when there is a match in either left (table1) or right (table2) table records.

> **Note:** FULL OUTER JOIN can potentially return very large result-sets!

#### FULL OUTER JOIN Syntax

```sql
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2 ON table1.column_name 
table2.column_name;
```

![](https://826093633-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS8lPNzCGPR5-DLbGXv%2F-LSXzHRu2LjlEMfjoonH%2F-LSXzh-V3JtffSyR8LF-%2Fimage.png?alt=media\&token=39a0a1fb-4b90-44f6-a033-c3477f55fe9b)

\
**Demo Database**

In this tutorial we will use the well-known Northwind sample database.

Below is a selection from the "Customers" table:

![](https://826093633-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS8lPNzCGPR5-DLbGXv%2F-LSXzHRu2LjlEMfjoonH%2F-LSXzqQpIT-VCzVrXlzc%2Fimage.png?alt=media\&token=2be9928c-ccba-4608-95b4-d3ef718527ec)

And a selection from the "Orders" table:<br>

![](https://826093633-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS8lPNzCGPR5-DLbGXv%2F-LSXzHRu2LjlEMfjoonH%2F-LSY-5GTWeZKvXAr_A75%2Fimage.png?alt=media\&token=78583090-d961-4784-8844-611c2d12670d)

\
SQL FULL OUTER JOIN Example

The following SQL statement selects all customers, and all orders:<br>

```sql
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:<br>

![](https://826093633-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LS8lPNzCGPR5-DLbGXv%2F-LSXzHRu2LjlEMfjoonH%2F-LSY-PPJDY9WaaqMTm93%2Fimage.png?alt=media\&token=d87e4d88-c997-4a51-8ecf-b7bfd7c71a7e)

> **Note:** The FULL OUTER JOIN keyword returns all the rows from the left table (Customers), and all the rows from the right table (Orders). 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.<br>

<br>

<br>

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gyansetu-sql.gitbook.io/sql-programming/sql-select/sql-joins/sql-full-outer-join-keyword.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
