Welcome to the Treehouse Community
Looking to learn something new?
I Need help trying to solve this:
In 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!
Umesh Ravji42,361 Points
Hi Tyler, you're almost there.
FROM Model LEFT OUTER JOIN Car ON Model.ModelName = Car.CarID
The two columns
CarID are not related, so it doesn't make much sense to perform a join using the two.
INNER JOIN Car ON Car.ModelID = Model.ModelID;
This is exactly the part you need for your
LEFT OUTER JOIN, so once you replace the first unnecessary join with this one (and make sure it is an
LEFT OUTER JOIN , you have your answer :)
SELECT ModelName, VIN FROM Model LEFT OUTER JOIN Car ON Car.ModelID = Model.ModelID;
james southFront End Web Development Techdegree Graduate 33,258 Points
it's asking you to use a type of join that includes records even if they don't have a match, so focus on that. the two tables have a common column that is used to join them.