Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare inner join and outer join SQL statements

What is the difference between an inner join and outer join? What's the precise meaning of these two kinds of joins?

like image 839
freenight Avatar asked Nov 26 '09 14:11

freenight


2 Answers

Check out Jeff Atwood's excellent:

A Visual Explanation of SQL Joins

Marc

like image 104
marc_s Avatar answered Sep 17 '22 15:09

marc_s


Wikipedia has a nice long article on the topic [here](http://en.wikipedia.org/wiki/Join_(SQL))

But basically :

  • Inner joins return results where there are rows that satisfy the where clause in ALL tables
  • Outer joins return results where there are rows that satisfy the where clause in at least one of the tables
like image 22
Glen Avatar answered Sep 19 '22 15:09

Glen