Searching Within a Range of Values2:57 with Andrew Chalkley
Again, writing shorter queries can help with readability and tracking down mistakes in our SQL code. In this video we'll go over the syntax of handling ranges of values in SQL.
SELECT <columns> FROM <table> WHERE <column> BETWEEN <lesser value> AND <greater value>;
SELECT * FROM movies WHERE release_year BETWEEN 2000 AND 2010; SELECT name, description FROM products WHERE price BETWEEN 9.99 AND 19.99; SELECT name, appointment_date FROM appointments WHERE appointment_date BETWEEN "2015-01-01" AND "2015-01-07";
See all of the SQL used in SQL Basics in the SQL Basics Cheat Sheet.
You need to sign up for Treehouse in order to download course files.Sign up