MySQL BETWEEN Operator (original) (raw)

Last Updated : 26 Mar, 2026

The BETWEEN operator in MySQL is used to filter results within a specified range, including both boundary values. It helps simplify queries by defining lower and upper limits in a concise way.

**Syntax:

SELECT column1, column2, ... FROM table_name WHERE column_name BETWEEN value1 AND value2;

Working with MySQL BETWEEN Operator

Let’s look at some examples of the MySQL BETWEEN operator to understand how it works in real queries. First, we create a demo table on which the BETWEEN operator will be used:

Screenshot-2026-03-26-122446

employees Table

Example 1: Salary Between 70000 and 80000

In this example, we retrieve employees whose salaries fall between 70,000 and 80,000.

**Query:

SELECT * FROM employees WHERE salary BETWEEN 70000 AND 80000;

**Output:

Screenshot-2026-03-26-122951

Example 2: Employee Names Between 'A' and 'M'

In this example, we use the BETWEEN operator on a text column to retrieve employees whose names fall alphabetically between 'A' and 'M'.

**Query:

SELECT * FROM employees WHERE name BETWEEN 'A' AND 'M';

**Output:

Screenshot-2026-03-26-123206

Example 3: Salary NOT Between 70000 and 80000

In this example, we use NOT BETWEEN to retrieve employees whose salaries fall outside the range of 70,000 to 80,000.

**Query:

SELECT * FROM employees WHERE salary NOT BETWEEN 70000 AND 80000;

**Output: