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.
Sam Speaks6,013 Points
What is this supposedly outputting? (Subqueries)
The question asks for the Make Name, but the error at the end says something about not outputting all of the Make ID's.
I have tried both starting with SELECT MakeID and SELECT ModelID.
Is there something i'm obviously missing here?
Challenge Task 1 of 4 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
SELECT ModelID FROM Model WHERE StickerPrice IN (SELECT * FROM Car WHERE StickerPrice > 30000);
Steven Parker221,323 Points
There are a few issues:
- the instructions ask for Model Names but ModelID is being selected
- the (main) filter condition uses StickerPrice but that column does not exist in the Model table
- the subquery should select only the column being compared by the WHERE...IN clause
- the main filter should use a column that is common to both tables