SQL Querying Employees with Department & Salary Criteria (WHERE, AND, BETWEEN)

SQL Querying Employees with Department & Salary Criteria (WHERE, AND, BETWEEN)

Verified Sources
Nov 3, 2026

To retrieve employees from an Employees table that match specific criteria (such as a particular department and a salary range), you typically use a SELECT statement with a WHERE clause. Commonly, you combine conditions with AND and filter numeric ranges using BETWEEN.

A canonical template is:

1SELECT * 2FROM Employees 3WHERE department = 'Engineering' 4 AND salary BETWEEN 70000 AND 100000;

This returns all rows where the employee is in the specified department and their salary falls within the inclusive bounds.

SQL WHERE clause and filtering (tutorial)

Key concepts you’ll use

  • WHERE restricts which rows are returned.
  • AND combines multiple filters.
  • BETWEEN makes range filtering concise.
  • NULL values require care (plain comparisons with = don’t match NULL).

[CalloutBlock]s below highlight practical gotchas when writing these queries.

Write the employee-filtering query (department + salary range)

  1. 1
    Step 1

    Use SELECT * to return all columns, or list specific columns like employee_id, name, department, salary for clarity and efficiency.

  2. 2
    Step 2

    Specify the table: FROM Employees.

  3. 3
    Step 3

    Use department = 'SomeDepartment' (match the exact values stored in the table).

  4. 4
    Step 4

    Use salary BETWEEN min AND max (range boundaries are inclusive in SQL’s BETWEEN).

  5. 5
    Step 5

    Join department and salary filters with AND inside the same WHERE clause.

  6. 6
    Step 6

    Confirm whether rows with boundary salaries should be included; also check whether salary or department can be NULL and decide whether to exclude them.

Example queries

1) Department + salary range using BETWEEN

1SELECT * 2FROM Employees 3WHERE department = 'Sales' 4 AND salary BETWEEN 50000 AND 90000;

2) Department + salary range (alternative with >= and <=)

Some teams prefer explicit comparisons:

1SELECT * 2FROM Employees 3WHERE department = 'Sales' 4 AND salary >= 50000 5 AND salary <= 90000;

3) Multiple criteria examples

  • Multiple departments:
1SELECT * 2FROM Employees 3WHERE department IN ('Sales', 'Marketing') 4 AND salary BETWEEN 50000 AND 90000;
  • Salary upper bound only:
1SELECT * 2FROM Employees 3WHERE department = 'Engineering' 4 AND salary <= 120000;

Pro Tip: Prefer explicit column lists

Using SELECT * is fine for practice, but in production prefer SELECT employee_id, name, department, salary to reduce transferred data and avoid surprises if the schema changes.

Beware NULLs in filtered columns

If department or salary can be NULL, then conditions like department = 'Sales' or salary BETWEEN 50000 AND 90000 will not match NULL rows. If you need to include them, you must handle NULL explicitly with IS NULL (or decide to exclude them).

How criteria narrow the result set

Conceptual example of filtering steps

From requirement to SQL

Define criteria

1

Identify the department value and the salary min/max boundaries."

Select & from

2

Choose columns and set FROM Employees."

Filter with WHERE

3

Add WHERE department = ... AND salary BETWEEN ...."

Test and validate

4

Verify inclusive/exclusive behavior on boundaries and check for NULL handling."

Common questions & edge cases

Knowledge Check

Question 1 of 4
Q1Single choice

Which SQL query returns employees in the 'Sales' department with salaries from 50000 to 90000?