Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Database Foundations SQL Calculating, Aggregating and Other Functions Grouping, Joining and Cleaning Up

Elena Paraschiv
Elena Paraschiv
9,938 Points

LEFT OUTERJOIN AND LEFT JOIN

Is there a difference between LEFT OUTER JOIN AND LEFT JOIN?

1 Answer

Hi Elena,

There is no difference between the two at least in mysql.

We can confirm this by looking at the documentation for the join syntax

In particular, the join table portion of the syntax:

join_table:
    table_reference [INNER | CROSS] JOIN table_factor [join_condition]
  | table_reference STRAIGHT_JOIN table_factor
  | table_reference STRAIGHT_JOIN table_factor ON conditional_expr
  | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition
  | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor

For the outer join (2nd to last option), OUTER is within square brackets. This means that it is optional. By contrast, LEFT|RIGHT is enclosed in curly braces which means you must choose one of those options.

To summarize, you could read {LEFT|RIGHT} [OUTER] JOIN as, "I must choose LEFT or RIGHT, optionally followed by OUTER, then followed by JOIN"

If I remember right, one of the code challenges involving OUTER JOIN did require you to use OUTER in the command. If that's the case then go ahead and put it in there to pass the challenge but in a real world scenario you should not have to use OUTER