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

Databases

Alain De La Cuadra
Alain De La Cuadra
21,890 Points

In a car database there is a Model table with columns, ModelID, MakeID and ModelName and a Car table with columns, CarID

cant get the VIN nr

2 Answers

I got this to work:

Select ModelName, VIN from Model left outer join Car on Model.ModelID = Car.ModelID;

I have a hard time understanding how it works as it seems I'm selecting VIN from MODEL, though... must be because of the left outer join. from the cheatsheet: "LEFT OUTER JOIN - JOINs all matching data and all non-matching rows from the left table in the query."

Ex. SELECT <columns> FROM <left table> LEFT OUTER JOIN <right right> ON <left table>.<column> = <right table>.<column>;

https://github.com/treehouse/cheatsheets/blob/master/querying_relational_databases/cheatsheet.md