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 Querying Relational Databases Joining Table Data with SQL JOIN Queries

Inner joins problem task 2

select MakeID, MakeName from Make
inner join Model on Make.MakeID = Model.MakeID
inner join Car on Model.ModelID = Car.ModelID;

What's wrong with the above? Help appreciated!

1 Answer

Kendell Dancy
Kendell Dancy
15,158 Points

You almost had it. Looks like you just forgot to select the fields they were asking for. (MakeName, ModelName, VIN, StickerPrice)

In a car database there is...

a Make table with columns, MakeID and MakeName

a Model table with columns, ModelID, MakeID and ModelName

a Car table with columns, CarID, ModelID, VIN, ModelYear and StickerPrice

For all cars in the database,

Show MakeName, ModelName, VIN and StickerPrice from the Model and Car tables in one result set.

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