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

Donnie Driskell
Donnie Driskell
2,243 Points

Join Queries 2 of 5

After a few hours, I now have to ask ! Please Help :-) Thanks, Donnie

In a car database there is a Make table with columns, MakeID and MakeName, a Model table with columns, ModelID, MakeID and ModelName and a Car table with columns, CarID, ModelID, VIN, ModelYear and StickerPrice. For all cars in the database, show Make Name, Model Name, VIN and Sticker Price from the Model and Car tables in one result set.

no-go SELECT MakeName, ModelName, VIN, StickerPrice FROM Make INNER JOIN Model ON Make.MakeID = Model.ModelID Car INNER JOIN Model ON Car.ModelID = Model.ModelID; Error near Car

no-go SELECT MakeName, ModelName, VIN, StickerPrice FROM Make INNER JOIN Model ON Make.MakeID = Model.ModelID Model INNER JOIN Car ON Model.ModelID = Car.ModelID; Error near Model

Donnie Driskell
Donnie Driskell
2,243 Points

Finally Figured it out ! It helped when I made a Venn Diagram. I also studied SQLite joining 3 tables examples. So the correct answer is:

SELECT MakeName, ModelName, VIN, StickerPrice FROM Make INNER JOIN MODEL ON Model.MakeID = Make.MakeID INNER JOIN Car ON Car.ModelID = Model.ModelID;

1 Answer

ivana kantnerova
ivana kantnerova
15,932 Points

yes, this is all right! SELECT MakeName, ModelName, VIN, StickerPrice FROM Make INNER JOIN MODEL ON Model.MakeID = Make.MakeID INNER JOIN Car ON Car.ModelID = Model.ModelID;