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 Subqueries Subqueries

Braedon Currah
Braedon Currah
10,272 Points

I think I have a correct answer, but the course doesn't clear.

I've tried changing lots of small details to see if I was missing something, but I honestly don't see what it is I missed. Any tips?

Braedon Currah
Braedon Currah
10,272 Points
SELECT ModelID FROM Model 
WHERE StickerPrice IN (
SELECT StickerPrice FROM Car 
WHERE StickerPrice > 30000
);
Braedon Currah
Braedon Currah
10,272 Points

Here are the instructions:

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.

Use a subquery along with IN to list all the Model Names with a Sticker Price greater than $30000

Here's the correction:

Bummer: The subquery doesn't return all ModelIDs for cars with the sticker price greater than 30000.

1 Answer

Steven Parker
Steven Parker
231,269 Points

Here's a couple of hints:

  • the instructions say "list all the Model Names ..." but this code selects "ModelID" instead
  • you'll need your outer WHERE clause and sub-query to use a field that both tables have in common