

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: AS Clause in SQL
incomplete
2: SQL Functions
incomplete
3: Between
incomplete
4: Distinct
incomplete
5: Logical Operators – AND
incomplete
6: OR
incomplete
7: In
incomplete
8: Like
incomplete
9: Underscore Operator
incomplete
10: Wildcards Quiz
incomplete
11: Query Practice – Discount Program
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
We can check if values are between two numbers using the WHERE clause in an intuitive way! The WHERE clause doesn't always have to be used to specify specific IDs or values. We can also use it to help narrow down our result set. Here's an example:
SELECT employee_name, salary
FROM employees
WHERE salary BETWEEN 30000 AND 60000;
This query returns all the employees name and salary fields for any rows where the salary is BETWEEN 30,000 and 60,000 inclusively! We can also query results that are NOT BETWEEN two specified values.
SELECT product_name, quantity
FROM products
WHERE quantity NOT BETWEEN 20 AND 100;
This query returns all the product names and quantities where the quantity was not between 20 and 100 (meaning it excludes 20 and 100). We can use conditionals to make the results of our query as specific as we need them to be.
We need to see how many young adults are using CashPal!
Query our users table to return the name and age fields of all users BETWEEN the ages of 18 and 30.