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

Pablo Caro
Pablo Caro
4,191 Points

Why is my between statement not working.

My code is not working. Can't get past this.

What statement are you trying and what challenge is this for?

6 Answers

Pablo Caro
Pablo Caro
4,191 Points

here is the code. very basic. I just want to confirm

select * from products where price between 10.99 and 12.99;

here is the instruction In the e-commerce database we have the products table with the columns id, name, description and price. Find all the products in the database with the price including and between 10.99 and 12.99.

That seems to be right. If you want to link to the challenge I can check if it's passing for me.

chase singhofen
chase singhofen
3,811 Points

the including messed me up even though i got it right on the 1st try i made myself go back and watch the video to make sure i didnt haveto type 'INCLUDING'

Challenge Task 1 of 2

In the e-commerce database we have the products table with the columns id, name, description and price. Find all the products in the database with the price including and between 10.99 and 12.99.

SELECT * FROM products WHERE price BETWEEN 10.99 AND 12.99;

id name description price 1 Retro Gaming T-Shirt All your fave gaming characters on one t-shirt. 10.99 2 Generic Super Hero T-Shirt Your fave super hero is on this shirt. Wear it. 11.99

Roy Yap
Roy Yap
17,968 Points

This is the correct answer! SELECT * FROM products WHERE price <= 10.99 and 12.99;

Pablo Caro
Pablo Caro
4,191 Points

https://teamtreehouse.com/library/sql-basics/finding-the-data-you-want/searching-within-a-range-of-values-2

so some context: I thought originally that we were using the >= <= but that did not work either. Thanks for the assist.

Pablo Caro
Pablo Caro
4,191 Points

I think it may just be an internal issue. It seems to be happening on just about most of my queries. I tried this one also and get results but i get message that I am missing a where clause. this missing where clause is a common theme. Below is the result of the query on the next step.

select * from products where name like '%t-shirt%';

id name description price 1 Retro Gaming T-Shirt All your fave gaming characters on one t-shirt. 10.99 2 Generic Super Hero T-Shirt Your fave super hero is on this shirt. Wear it. 11.99 3 Some Quirky Phrase T-Shirt Annoy your friends with this t-shirt. They'll seeing this phrase everytime you wear it. 9.99

I tried both queries you posted in their respective challenges and they both passed fine for me.

Have you tried a different browser?

If the problem persists, I would contact treehouse support.

SELECT * FROM products WHERE price BETWEEN 10.99 AND 12.99;

id name description price 1 Retro Gaming T-Shirt All your fave gaming characters on one t-shirt. 10.99 2 Generic Super Hero T-Shirt Your fave super hero is on this shirt. Wear it. 11.99