SQL

What’s the difference between RIGHT, LEFT, OUTER, INNER, JOIN

Written by Ian Carnaghan · 32 sec read >

The difference is the way the tables are joined if no common records are available.

RIGHT – RIGHT JOIN is the opposite of LEFT JOIN and the same as RIGHT OUTER JOIN. Shows all records from the right table and only matching records from the left table.

LEFT – LEFT JOIN shows all records from the left table does not matter if matching records in the right table exists or not. Also the same as LEFT OUTER JOIN.

JOIN – JOIN is the same as INNER JOINJOIN means to only show records common to both tables. Will only show records if the same ID value exists in all tables used. If we have a product’s table and a categories table, both have columns with name product_id. If the product_id in the product’s table does not match the product_id in the categories table. No results will show.

Last Updated On March 23, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. In my spare time I teach undergraduate classes in web development. Profile

Leave a Reply

avatar
  Subscribe  
Notify of