BETWEEN Operator in SQL

Level 369 keystrokes

BETWEEN selects values within a range, inclusive of both endpoints.

SQL code

1SELECT
-- Returns the name and price columns
2 name,
3 price
4FROM
5 products
6WHERE
-- BETWEEN is inclusive: 10.00 and 50.00 themselves match
-- Same as price >= 10.00 AND price <= 50.00
7 price BETWEEN 10.00 AND 50.00;

Output

+---------+-------+
| name    | price |
+---------+-------+
| Widget  | 15.00 |
| Gadget  | 25.00 |
| Tool    | 45.00 |
+---------+-------+
3 rows in set
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this SQL code and how often they appear.

  • .× 2
  • ,× 1
  • ;× 1

More SQL examples at level 3

← SQL typing practice