---
title: "What is the difference between the INNER JOIN and the OUTER JOIN in SQL?"  
description: "What is the difference between the INNER JOIN and the OUTER JOIN in SQL?"  
author: "Revati S Misra"  
published: 2023-06-30  
updated: 2023-07-01  
canonical: https://www.mindstick.com/forum/158908/what-is-the-difference-between-the-inner-join-and-the-outer-join-in-sql  
category: "mssql server"  
tags: ["mssql server", "sql server", "sql"]  
reading_time: 3 minutes  

---

# What is the difference between the INNER JOIN and the OUTER JOIN in SQL?

What is the [difference between the INNER](https://www.mindstick.com/forum/159822/what-is-the-difference-between-the-inner-join-and-left-join-in-sql-and-when-should-each-be-used) JOIN and the [OUTER](https://answers.mindstick.com/qa/116605/what-is-the-difference-between-inner-join-left-join-right-join-and-full-outer-join) [JOIN in SQL](https://www.mindstick.com/forum/33686/what-is-a-self-join-in-sql-server)?

## Replies

### Reply by Aryan Kumar

Sure. Here are the key differences between inner joins and outer joins in [SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database):

| **[Inner Join](https://www.mindstick.com/forum/33572/sql-inner-join-keyword)** | **[Outer Join](https://www.mindstick.com/forum/159328/mysql-outer-join-syntax-error)** |
| --- | --- |
| Returns rows where there is a match in both tables. | Returns all rows from the **left** table, even if there is no match in the **right** table. |
| The **ON** clause is used to specify the join condition. | The **ON** clause is used to specify the join condition, and the **OUTER** keyword is used to specify the type of outer join. |
| The **WHERE** clause can be used to filter the results of the join. | The **WHERE** clause can be used to filter the results of the join, but it cannot be used to change the rows that are returned by the outer join. |
| The **INNER JOIN** keyword is used to create an inner join. | The **LEFT JOIN**, **RIGHT JOIN**, and **FULL JOIN** keywords are used to create outer joins. |

Here are some examples of how inner joins and outer joins can be used:

- **Inner join:** To find all customers who have placed an order, you would use an inner join on the `customers` and `orders` tables. The `ON` clause would specify that the `customer_id` column in the `customers` table matches the `customer_id` column in the `orders` table.
- **Left outer join:** To find all customers, regardless of whether they have placed an order, you would use a left outer join on the `customers` and `orders` tables. The `ON` clause would specify that the `customer_id` column in the `customers` table matches the `customer_id` column in the `orders` table. The left outer join would return all rows from the `customers` table, even if there is no match in the `orders` table.
- **Right outer join:** To find all orders, regardless of whether they have a corresponding customer, you would use a right outer join on the `customers` and `orders` tables. The `ON` clause would specify that the `customer_id` column in the `customers` table matches the `customer_id` column in the `orders` table. The right outer join would return all rows from the `orders` table, even if there is no match in the `customers` table.
- **Full outer join:** To find all customers and orders, regardless of whether there is a match between them, you would use a full outer join on the `customers` and `orders` tables. The `ON` clause would specify that the `customer_id` column in the `customers` table matches the `customer_id` column in the `orders` table. The full outer join would return all rows from both tables, even if there is no match between them.


---

Original Source: https://www.mindstick.com/forum/158908/what-is-the-difference-between-the-inner-join-and-the-outer-join-in-sql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
