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

Why is it an INNER JOIN, not a LEFT OUTER JOIN, because if a car doesn't have a make I still want to show it?

It says "For all cars..." which makes me think an OUTER JOIN is the best option. Why does it only allow inner joins?

Stuart Wright
Stuart Wright
41,119 Points

Can you post a link to the challenge please?

2 Answers

Steven Parker
Steven Parker
231,128 Points

This is a bit of a guess.

Since you didn't say which challenge, or which task, I'm taking a guess here. But if you're talking about the challenge which says "For all cars in the database, show Model Name, VIN and Sticker Price in one result set." reasons that an INNER JOIN might be expected:

  • they did not explicily ask for cars without ModelId's to be included
  • they only want rows with complete data
  • every car might be required to have a ModelId (it might be a non-NULL field)

However, you might still want to report this as a bug to Support, it might get you a "special Exterminator badge" and/or get the wording of the question changed to make the requirements more clear.

Mike Wittenauer
Mike Wittenauer
17,095 Points

I was thinking along the lines of Steven Parker, the cars are probably required to have a ModelID which means an inner join will still return all cars.