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.

Colton Wollin
738 PointsHow can I find everything that isn't one of the numbers?
Review ratings should be only be 1-5. Find all the invalid ratings in one query. So far I have SELECT * FROM reviews WHERE ratings
and then I'm not sure how to go from there.
4 Answers

Carlos Federico Puebla Larregle
21,073 PointsThen you do it like this:
SELECT *
FROM reviews
WHERE ratings NOT BETWEEN 1 AND 5;
I hope that helps a little bit.

Abram McCreary
1,371 PointsYou use NOT BETWEEN.

A X
12,842 PointsColton, I assume you're referring to a code challenge, but I have no idea which one as the ones after Filtering Out have to do with books not ratings. I think what you're asking about has to do with using BETWEEN:
SELECT *
FROM reviews
WHERE ratings BETWEEN 1 AND 5;
So this query will return all fields from reviews where the rating of the review is between 1 and 5. You may want to review "Searching within a Range of Values": https://teamtreehouse.com/library/sql-basics/finding-the-data-you-want/searching-within-a-range-of-values for more information.
If this isn't what you're looking for, I'm happy to help, but it might be good to re-phrase your question and point to a specific challenge...if that's the issue.

Colton Wollin
738 PointsI need the opposite of that. It's an sql playground challenge. It's basically I need every rating that is NOT 1 through 5

Bartlomiej Zabielski
Courses Plus Student 10,363 Pointsyeah NOT BETWEEN i got confused and kept trying IS NOT BETWEEN derp derp
A X
12,842 PointsA X
12,842 PointsColton, I'm a tad confused by your original question. "Review ratings should be only 1-5" will be a different query than "Find all the invalid ratings in one query" query. Carlos addresses the invalid ratings query. My code addresses the "Review ratings should be only 1-5". So between Carlos and myself you can see that changing a simple word can change a lot with the outcome and the meaning of the query!