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

It's a Database challenge question

Challenge Task 4 of 5

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!

Link: https://teamtreehouse.com/library/querying-relational-databases/joining-table-data-with-sql/join-queries

My last attempted code: > SELECT Model.ModelName from Model LEFT OUTER JOIN on Car.VIN = Model.ModelID, VIN;

Please don't tell me to watch the videos again, do provide "hints" or explain what I'm doing wrong, so I can figure it out. The code I have placed is one of a hundred versions, it's not the only attempt.

Thanks for any helpful input.

3 Answers

Konrad Traczyk
Konrad Traczyk
22,287 Points
  1. You're missing table name between JOIN and ON keywords.
  2. I don't know why VIM column is at the end of your query, it should be after SELECT keyword.
  3. Also you have to put column ModelID from Car table instead of VIN column to your join expression(Car.VIN = Model.ModelID).

If you still having trouble see this page about SQL Joins.

Hope it helps.

Thank you for the direction. It's been a few hours since I've worked on the challenge question. I'm going back to try to tackle it now.

I tried multiple variables before posting, in fact a couple of hours worth. After a while everything just became wild off the wall attempts. Thanks for the direction.