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

Bug in latest Challenge Task 1 of 4 in Querying Relational Databases???

This SQL works perfectly in the SQL Playground, but not here. I do not understand why not. SELECT m.ModelName, c.StickerPrice FROM Model m INNER JOIN Car c ON m.ModelID = c.ModelID WHERE c.StickerPrice IN ( SELECT StickerPrice FROM Car WHERE StickerPrice > 30000 );

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hi there, Bernt.

You will need to provide a link to the actual challenge in order for us to properly help you troubleshoot.

Challenges are very picky and extremely specific. So, what works in the playground may not work in the challenges, not because of syntax, buy because it isn't specifically what the challenge asked for.

:dizzy:

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

That is link to challenge

https://teamtreehouse.com/library/querying-relational-databases/subqueries/subqueries

Can't pass it as well...

The error is explainable, but I've no idea how to solve it...

Program basically checks that subquery with IN should return ModelId.

Your subquery SELECT StickerPrice FROM Car WHERE StickerPrice > 30000 obviously return StickerPrice and not ModelId.

that is why error occurs, I've no idea how to solve problem otherwise:

i tried:

SELECT m.ModelName, c.StickerPrice
FROM Model m INNER JOIN Car c ON m.ModelID = c.ModelID
  WHERE c.ModelId IN (
    SELECT ModelId
    FROM Car
    WHERE StickerPrice > 30000
    );

Does not work :(

The other constraint in challenge that you cannot write anyhing in JOIN, like JOIN ( ... ) will fail.

so we cannot write MORE than ONE subqueries. It has to be one subquery and with IN keyword.

It also MUST return ModelId and ONLY ModelId.

How to do it - no idea ...

1 Answer