# When to use inner joins versus outer joins

**URL:** <https://forum.codewithmosh.com/t/when-to-use-inner-joins-versus-outer-joins/10293>\
**Category:** SQL\
**Created:** [January 28, 2022, 7:05pm UTC](https://forum.codewithmosh.com/t/when-to-use-inner-joins-versus-outer-joins/10293 "2022-01-28T19:05:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tnguyen](https://avatars.discourse-cdn.com/v4/letter/t/6f9a4e/32.png) [@tnguyen](https://forum.codewithmosh.com/u/tnguyen)\
**Post date:** [January 28, 2022, 7:05pm UTC](https://forum.codewithmosh.com/t/when-to-use-inner-joins-versus-outer-joins/10293/1 "2022-01-28T19:05:50Z")

</div>

What are real life examples of when to use inner versus outer joins? Would it be safer to use outer joins first since it returns all items including null and then just determine from there if the rows that return null are worth keeping? Thanks.

---

<div class="post-metadata">

**Author:** ![eelsholz](https://avatars.discourse-cdn.com/v4/letter/e/439d5e/32.png) [@eelsholz](https://forum.codewithmosh.com/u/eelsholz)\
**Post date:** [January 30, 2022, 12:38am UTC](https://forum.codewithmosh.com/t/when-to-use-inner-joins-versus-outer-joins/10293/2 "2022-01-30T00:38:59Z")

</div>

Say you have a customers table and an orders table, and you want to get the data on the customers and their orders, even for those customers who don’t yet have any orders. You could use an outer join, because you’ll get a row even for those customers without an order. If instead you want the data on just those customers who have placed orders, you could use an inner join, because you won’t get any rows for those customers who don’t have an order. The query that you write, inner join vs outer join etc., depends on the question you are asking of your data.
