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 Querying Relational Databases Joining Table Data with SQL JOIN Queries

Teacher Russell
Teacher Russell
16,873 Points

A little help with the approach of solving this challenge.

I can look at answers posted and see my error, but I'm still very fuzzy here. It would have been very helpful to have a follow up explanation of these final exercises. Can someone give a little more in-depth explanation on how to begin looking at this one? Thanks in advance!:)

Teacher Russell
Teacher Russell
16,873 Points

Sorry, I thought it would be visible. What I'm generally having trouble with is which column to select when. I just goofed on the final challenge, too. I chose FROM SalesRep, and tried to LEFT OUTER JOIN the Sale table, because I thought I needed to, to get every value from that table.
In the 2nd challenge, I believe it was a matter of placing the Car on the wrong side of the comparison.

1 Answer

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Points

Here is my solution, and an explanation:

SELECT Model.ModelName, Car.VIN, Car.StickerPrice FROM Model INNER JOIN Car ON Model.ModelID = Car.ModelID;
  • I'm selected all the columns that were requested by the challenge - ModelName, VIN, StickerPrice - with the explicit Column I'm selected them from. This isn't absolutely necessary but it helps make it clearer to understand.
  • I just used INNER JOIN because in this case it doesn't seem to matter. Outer joins are for letting it know what to do if there are missing values.

Let me know if you have any questions.