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
12,318 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;