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 trialgeorge spooner
2,952 PointsCoding Challenge at the end of the Querying Relational Databases, JOIN challenge 2 of 5.. no matter what I put it always
SELECT Make.MakeName, Model.ModelName, Car.VIN, Car.StickerPrice FROM Car INNER JOIN Model ON Model.ModelID = Car.CarID INNER JOIN Make ON Make.MakeID = Car.CarID;
Why do I get the select MakeName, ModelName, VIN, StickerPrice error.. It returns the correct thing from the database..
1 Answer
Maciej Torbus
8,137 PointsHello George,
this task may be little tricky. Please take notice that the error doesn't always tell you everything. You are absolutely selecting the right colums, but please take a closer look at the result table.
Remember that you have to match (join) primary key from one table to corresponding foreign key in another table. CarID for example isn't foreign key it any of the tables, it's only primary key of Car table. While this might not be clear to see in result table, you should be able to notice second mistake in joining makes with models.
In your result table you probably have results like Chevy Focus or BMW Grand Cherokee. So you are selecting the right colums but they are not matched properly.
If you are not an expert on cars, you can play around and familiraze yourself with data and database schema somewhere in SQL Playgrounds. I remember that this car database has been somewhere before.
Hope I could help you and please remember that this topic isn't that easy, I still have problems with JOINs all the time. Feel free to ask me any question if this one was helpful!
george spooner
2,952 Pointsgeorge spooner
2,952 PointsThank you very much, your guidance worked. I am past that challenge now. I thought there might have been a bug but as you mentioned I wasn't matching things properly.
Much appreciated.
Maciej Torbus
8,137 PointsMaciej Torbus
8,137 PointsI'm glad that I was able to help you out!