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

Can't see where the code is wrong

Hi everyone!

I can't see where the code below is wrong. Need some help.

SELECT id, name, description, price FROM products WHERE price IN (7.99, 9.99, 11.99);

Thanks!

Sergey Podgornyy
Sergey Podgornyy
20,660 Points

Ramon, can you post a task question, please? It looks like your code is correct.

Hi Sergey,

The task question is:

"We have an e-commerce database. Inside the products table we have the columns of id, name, description and price. Without using the OR keyword, find all products with the price of 7.99, 9.99 or 11.99."

7 Answers

Hi Ramon,

So you are trying Task 1 of 2, searching-within-a-set-of-values

"We have an e-commerce database. Inside the products table we have the columns of id, name, description and price. Without using the OR keyword, find all products with the price of 7.99, 9.99 or 11.99."

Your answer was bringing back the correct results, but you hadn't written it the way they wanted you to. It asks you to 'find all products' so it is expecting you to use * instead of listing out the 4 columns. So try:

SELECT * FROM products WHERE price IN (7.99, 9.99, 11.99);

Thank you!! I wasn't thinking about that possibility!

chase singhofen
chase singhofen
3,811 Points

i did this and it marked it wrong it asked if i used the products table. but then i retyped it and it marked it correct so idk.

SELECT * FROM products WHERE price IN (7.99, 9.99, 11.99); WORKS COOL..

Nasir Atta
Nasir Atta
2,177 Points

select * from products where price != 9.99;

SELECT * FROM products WHERE price != "9.99";

SELECT * FROM products WHERE price IN (7.99, 9.99, 11.99);

SELECT * FROM products WHERE price IN (7.99,9.99,11.99);

SELECT id, name, description, FROM products WHERE price IN (7.99, 9.99, 11.99);

Hi Cristopher,

Unfortunately it didn't work =/

SELECT * FROM products WHERE price IN (7.99, 9.99, 11.99);