Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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)

Thanks!

Hi Clair,

Thank you for addressing this matter.

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

Thanks a million.

-Aleksandra Klipa

1 Answer

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