Multiple Joins

You can join more than just 2 tables. Something like…

SELECT *
FROM table_a
JOIN table_b
  ONLEFT JOIN table_c
  ON

Why would you need this? Sometimes you just need information from 3 or more tables. We'll see an example of that in the next challenge. Another reason would be that you have tables with a many-to-many type relationship. We'll look at that a bit later.

Join Order

When you have more than 2 joins, it happens left-to-right (or top-to-bottom if that's how it's formatted). Something like table_a join table_b join table_c would execute like (table_a join table_b) join table_c.

Efficiency

Generally speaking, joins can be computationally expensive. It depends on a lot of factors like the sizes of the tables, database settings, etc. So, be wary of having 3 or more joins and try to avoid that when possible.

© 2022 Andrew Carlson. All rights reserved.