Learning LEFT OUTER JOIN syntax

To LEFT OUTER JOIN two tables, use the following syntax:

SELECT column(s)FROM table1LEFT OUTER JOIN table2ON table1.column = table2.columnWHERE conditions ORDER BY column(s); 

The preceding syntax shows you how to join two tables together with a LEFT OUTER JOIN. You join a column in table1 that matches a column in table2. The WHERE and ORDER BY clauses are optional. They are there to show you that the LEFT OUTER JOIN syntax goes between the FROM and WHERE clauses.

The following example will help you to understand how to use the LEFT OUTER JOIN:

SELECT p.playerid, birthyear, schoolid, yearid FROM lahmansbaseballdb.people p LEFT OUTER JOIN lahmansbaseballdb.collegeplaying c ON p.playerid = c.playerid WHERE ...

Get Learn SQL Database Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.