SELECT Statements SQL Topic exerciseEasyVerified answerSQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

SELECT with Multiple Conditions

Return employees in department 10 with salary between 60000 and 90000.

  • Filtering

Exercise brief

Understand the request

HR analytics manager The staffing review is looking only at IT employees whose salary falls within the target band.

Find employees in the IT department (department_id = 10) whose salary falls between $60,000 and $90,000 inclusive. Show first_name, last_name, salary, and department_id.

Return

  • Return first_name, last_name, salary, and department_id.

Constraints

  • Use multiple conditions in the WHERE clause.

Data you will use

Review the relevant tables before deciding how to join, filter, or aggregate them.

employees

  • first_nameVARCHAR(50)
  • last_nameVARCHAR(50)
  • salaryINTEGER
  • department_idINTEGER

Hints, when you need them

Open one clue at a time so you still do the reasoning.

Hint 1

Both conditions must be true at the same time → use AND, not OR.

Hint 2

BETWEEN x AND y is inclusive on both sides. It is shorthand for `>= x AND <= y`.

Hint 3

WHERE salary BETWEEN 60000 AND 90000 AND department_id = 10

Verified SQL answer

Attempt the problem first, then compare structure and reasoning—not just syntax.

Reveal solution and explanation
SELECT first_name, last_name, salary, department_id FROM employees WHERE salary BETWEEN 60000 AND 90000 AND department_id = 10;

Why this works

AND requires every condition to be true for the row to pass. BETWEEN is inclusive — both endpoints qualify. The expected answer is 3 employees (Alice, Bob, Grace) — all in IT with salaries inside that range.

Expected result

Use this output to verify values, aliases, ordering, and row count.

first_namelast_namesalarydepartment_id
AliceJohnson8500010
BobWilson8000010
GraceWhite9000010

Learn the concepts behind this answer

Strengthen your understanding with these targeted learning topics:

Continue practicing

SQL Practice Online

Open the interactive workspace and practice across SQL topics.