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 trialAlain De La Cuadra
21,890 PointsPlease help querying Relation Database challenge 4/5
I getting a bummer
Alain De La Cuadra
21,890 PointsCan i please do it tomorrow its 23.00 here in Sweden must go and sleep thanx for quick answer sorry i will try the challenge again
12 Answers
Kevin Gates
15,053 PointsThe correct answer for challenge 4/5 is this:
SELECT m.ModelName, c.VIN
FROM Model AS m
LEFT OUTER JOIN Car AS c
ON m.ModelID = c.ModelID;
So, Jacob Iraheta , on yours, it's important that the first table listed (the one after the FROM keyword) is Model. By using a LEFT OUTER JOIN
, you are saying "When I compare TABLE 1 (Model) to TABLE 2 (Car), then IF the TABLE 2 does not have a value, return null instead."
This means for this challenge that a Model (say "Civic") hasn't sold yet, therefore it's not an entry on the car table, even though that model technically exists.
Joel McCracken Jr
3,142 PointsThis is what fixed it for me
Select Model.ModelName, Car.VIN from Model left outer join Car on Car.Modelid = Model.ModelID left outer join Make on Model.MakeID = Make.MakeID;
Nice! You're doing great!
Shea Matthew Kennisher
2,574 PointsWhy does this even work if there is no Make table in this question?
Charlie Harcourt
8,046 PointsBut why? Where does the Make come into this?
Charlie Harcourt
8,046 PointsSelect Model.ModelName, Car.VIN from Model left outer join Car on Car.Modelid = Model.ModelID left outer join Make on Model.MakeID = Make.MakeID;
This code works but I am wondering if anyone can explain why it works and where does the Make come into this
ALBERT QERIMI
49,872 PointsAndrew Chalkley i think is a bug in database Attach my code to this post. checkbox .
asked two questions lately but code didn't show on question Thanks
Alain De La Cuadra
21,890 PointsSelect Make.MakeName, Model.ModelName, Car.VIN,Car.StickerPrice from Car left outer join Model on Car.ModelID = Model.ModelID left outer join Make on Model.MakeID = Make.MakeID
Alain De La Cuadra
21,890 PointsPlease help querying Relation Database challenge 4/5
Bummer Your query didn't select the ModelName
and VIN
correctly! please explain to me what is wrong i asked my teacher but he did not understand the quiz
Select Model.ModelName, Car.VIN,Car.StickerPrice from Model left outer join Car on Car.Modelid = Model.ModelID left join Make on Model.MakeID = Make.MakeID;
Andrew Chalkley
Treehouse Guest TeacherLooks like this left join Make on Model.MakeID = Make.MakeID;
isn't needed on 4 / 5.
Alain De La Cuadra
21,890 Pointshere are the quiz I n a car database there is a Model table with columns, ModelID, MakeID and ModelName and a Car table with columns, CarID, ModelID, VIN, ModelYear and StickerPrice. Show all Model names from the Model table along with VIN from the Car table. Make sure models that aren’t in the Car table still show in the results!
Alain De La Cuadra
21,890 Pointsselect Model, ModelID, VIN,ModelYEAR, stickerprice from Model left outer join Car
Alain De La Cuadra
21,890 PointsSelect Model.ModelName, Car.VIN,Car.StickerPrice from Model left outer join Car on Car.Modelid = Model.ModelID left join Make on Model.MakeID = Make.MakeID; BUMMER please help
Andrew Chalkley
Treehouse Guest TeacherSo you're on this Code Challenge: https://teamtreehouse.com/library/querying-relational-databases/joining-table-data-with-sql/join-queries and which task?
What does it say after "bummer"?
saraham
247 PointsSelect Model.ModelName, Car.VIN,Car.StickerPrice from Car inner join Model on Car.ModelID = Model.ModelID inner join Make on Model.MakeID = Make.MakeID
Jacob Iraheta
2,182 Pointsanyone have an answer to this and why the below code works??? maybe the question written incorrectly?
Select Model.ModelName, Car.VIN from Model left outer join Car on Car.Modelid = Model.ModelID left outer join Make on Model.MakeID = Make.MakeID;
kevin hudson
Courses Plus Student 11,987 PointsAnyone that used Make table has either just copied from someone else in the forum or has a completely different Challenge 4/5 than me and some others. Please explain why or how you got your answer then.
SELECT ModelName, VIN FROM Model LEFT OUTER JOIN Car ON Model.ModelID = Car.ModelID
WHERE Car.ModelID IS NULL;
Yes this should work, and I tried different ways to select the columns and get this error:
Bummer: Your query didn't select the ModelName
and VIN
correctly!
Only thing I can think of is that you make another table to put both together
Kevin Gates
15,053 PointsSee my answer posted above on January 7.
Andrew Chalkley
Treehouse Guest TeacherAndrew Chalkley
Treehouse Guest TeacherPlease provide your code.