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!

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 Using IN with Subqueries to Filter Data

Claire Brehm
Claire Brehm
9,098 Points

Task 1 challenge help

The question: 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

My code: SELECT modelid FROM model WHERE modelid IN (SELECT stickerprice FROM car WHERE stickerprice > 30000)


Hi Clair,

Thank you for addressing this matter.

Did you manage to fins the correct answer for this one?

Thanks a million.

-Aleksandra Klipa

2 Answers

Since modelid IN is trying to match modelid's your subquery should be retrieving modelid's.

I'm doing this today, gonna leave my code here to help out next person that encounters issues with this one.

SELECT modelname FROM model WHERE modelid IN (SELECT modelid FROM car WHERE stickerprice > 30000);