← 30 Days of SQL
Day 3 / 30Filtering

LIKE, IN, BETWEEN and IS NULL

Pattern matching and range filtering — essential for working with real-world messy data.

1
Easy

Find all employees whose name starts with "A".

SQL Answer
SELECT * FROM employees
WHERE name LIKE 'A%';
💡

% matches any sequence of characters. _ matches exactly one character. So LIKE "_a%" means: any single character, then "a", then anything.

2
Easy

Find employees whose email contains "gmail".

SQL Answer
SELECT * FROM employees
WHERE email LIKE '%gmail%';
💡

Placing % on both sides searches anywhere in the string. LIKE is not case-sensitive in MySQL by default but is in PostgreSQL.

3
Easy

Select employees from Sales, HR, or Finance departments.

SQL Answer
SELECT * FROM employees
WHERE department IN ('Sales', 'HR', 'Finance');
💡

IN is cleaner than writing multiple OR conditions. NOT IN excludes those values. Be careful: NOT IN returns no rows if any value in the list is NULL.

4
Easy

Find employees with salary between 30000 and 60000.

SQL Answer
SELECT * FROM employees
WHERE salary BETWEEN 30000 AND 60000;
💡

BETWEEN is inclusive — it includes both boundary values. Equivalent to: WHERE salary >= 30000 AND salary <= 60000.

5
Easy

Find all employees who have no manager assigned (manager_id is NULL).

SQL Answer
SELECT * FROM employees
WHERE manager_id IS NULL;
💡

Never use = NULL. NULL means unknown, so NULL = NULL is not true — it is also NULL. Always use IS NULL or IS NOT NULL.

6
Medium

Find employees hired between Jan 2023 and Dec 2023.

SQL Answer
SELECT * FROM employees
WHERE hire_date BETWEEN '2023-01-01' AND '2023-12-31';
💡

BETWEEN works on dates too. Always use ISO format (YYYY-MM-DD) for dates in SQL to avoid regional format confusion.

EVIKA ACADEMY · SQL FOR DATA ANALYTICS

Want to master SQL with live practice?

Join our SQL for Data Analytics course — live classes in Noida and online across India.

Book Free Demo Class →
← PREVIOUSDay 2: ORDER BY, LIMIT and DISTINCTNEXT →Day 4: Aggregate Functions — COUNT, SUM, AVG, MAX, MIN
Best Data Analytics Course in Noida Delhi NCR | EVIKA ACADEMY