DataBolt

SQL LEARNING PLATFORM

4

CHAPTER 4

BETWEEN, IN, LIKE

Smarter filters for rnages, lists, and patterns.

7

Learning Blocks

SQL

Interactive Queries

In This Chapter

Concepts you'll master

1

BETWEEN for range filtering (inclusive)

2

IN to match against a list of values

3

NOT IN to exclude a list

4

LIKE with % and _ wildcards for pattern matching

6.1 - BETWEEN

SQL QUERY
SELECT name, salary 
FROM employees
WHERE salary BETWEEN 60000 AND 75000;

🌟 Note: BETWEEN is inclusive on both ends. BETWEEN 60000 AND 75000 is exactly equivalent to salary >= 60000 AND salary <= 75000

6.2 - IN

SQL QUERY
SELECT name, department 
FROM employees
WHERE department IN ('IT', 'HR');

✅ Pro Tip: IN is cleaner than chaining multiple OR conditions. WHERE dept IN ('IT','HR','Finance','Legal') vs four OR conditions — it's more readable and equally fast

SQL QUERY
SELECT name 
FROM employees
WHERE name LIKE '%a';

Exercise

Practice your SQL skills

SQL EDITOR
Press semicolon (;) to auto-run query

Tasks

Complete all SQL challenges

1

Find employees whose salary is between 60000 and 80000.

Current Task
2

Find employees hired between 2021-01-01 and 2022-12-31.

3

Find employees who are in IT or HR using IN.

4

Find employees whose name starts with 'R'.

5

Find employees: who are in IT or Sales, and have salary between 60000 and 90000.

Need help solving this task?