Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Filtering results by date can be handy for finding entries before or after a specific date. In this video, we'll explore filtering by dates.
Relational Operators
There are several relational operators you can use:
-
<
less than -
<=
less than or equal to -
>
greater than -
>=
greater than or equal to
These are primarily used to compare numeric and date/time types.
SELECT <columns> FROM <table> WHERE <column name> < <value>;
SELECT <columns> FROM <table> WHERE <column name> <= <value>;
SELECT <columns> FROM <table> WHERE <column name> > <value>;
SELECT <columns> FROM <table> WHERE <column name> >= <value>;
Examples:
SELECT first_name, last_name FROM users WHERE date_of_birth < '1998-12-01';
SELECT title AS "Book Title", author AS Author FROM books WHERE year_released <= 2015;
SELECT name, description FROM products WHERE price > 9.99;
SELECT title FROM movies WHERE release_year >= 2000;
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Holly Bancroft
5,162 Points1 Answer
-
Andrew Davis
2,405 PointsWhy are the exercises already filled in on my SQL workspace?
Posted by Andrew DavisAndrew Davis
2,405 Points3 Answers
-
Jeffrey Vierra
25,404 Points3 Answers
-
Luis Manuel Lopez Hidalgo
Full Stack JavaScript Techdegree Student 23,195 PointsNot a question but a comment. I think in the last part of the video what we want is the patron_id and not the id.
1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up