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

Challenge task 2 from the Joining Table Data With SQL section. I get: SQL Error: no such column: MakeName.

I’m trying to complete challenge task 2 from the Joining Table Data With SQL section of the Querying Relational Databases course.

Here’s the challenge text: “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.”

I’ve written the following SQL:

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

and I get the following error: SQL Error: no such column: MakeName

1 Answer

Steven Parker
Steven Parker
231,127 Points

You're joining the Model table to itself (and then to Car), but it looks like you intended to join the Make table to Model and Car.

Changing "... FROM Model ..." to "... FROM Make ..." should resolve the issue.