IN, BETWEEN, and LIKE Operators in SQL
IN BETWEEN LIKE operators in SQL are used to filter data in a clear and flexible way. These operators help you match multiple values, ranges, or patterns in a single query. As a result, your SQL queries become easier to read and more powerful.
Instead of writing long conditions, you can use these operators to simplify your WHERE clause. For beginners, this makes SQL easier to understand and apply in real projects. Moreover, these operators are widely used in reports, dashboards, and data analysis.
Sample Table for Examples
We will use this table in all examples below.
students data
| id | name | age | city | marks |
|---|---|---|---|---|
| 1 | Rahul | 20 | Delhi | 85 |
| 2 | Neha | 18 | Mumbai | 92 |
| 3 | Amit | 22 | Delhi | 78 |
| 4 | Priya | 19 | Pune | 88 |
| 5 | Karan | 21 | Mumbai | 90 |
IN Operator in SQL
The IN operator in SQL allows you to match a column with multiple values. Rather than using many OR conditions, you can list all values in one place.
For example, you can fetch students from selected cities using a single query. This not only saves time but also keeps your query clean.
Syntax
SELECT*FROM table_nameWHERE column_name IN (value1, value2, value3);
Example
SELECT*FROM studentsWHERE city IN ('Delhi', 'Mumbai');
This query shows students from Delhi and Mumbai.
BETWEEN Operator in SQL
The BETWEEN operator in SQL filters data within a fixed range. It works well with numbers, dates, and even text values.
For instance, you can easily find students whose marks fall between two values. Because the range is clear, the query becomes easier to read and maintain.
Syntax
SELECT*FROM table_nameWHERE column_name BETWEEN value1 AND value2;
Example
SELECT*FROM studentsWHERE marks BETWEEN80AND90;
This query returns students who scored between 80 and 90.
LIKE Operator in SQL
The LIKE operator in SQL helps you search data using patterns. It is mostly used with text columns and wildcard characters.
Using LIKE, you can find names that start, end, or contain specific letters. Therefore, it is very useful for search features and filters.
Wildcards Used
% matches many characters_ matches one character
Syntax
SELECT*FROM table_nameWHERE column_name LIKE pattern;
Example 1: Names Starting with R
SELECT*FROM studentsWHERE name LIKE'R%';
This query finds names that start with R.
Example 2: Names Ending with a
SELECT*FROM studentsWHERE name LIKE'%a';
This query finds names that end with a.
Example 3: Names with Five Letters
SELECT*FROM studentsWHERE name LIKE'_____';
In SQL, the underscore _ is a wildcard used with the LIKE operator. Each underscore represents one single character. Because the pattern contains five underscores, SQL looks for names that are five characters long, no more and no less.
Using IN BETWEEN LIKE operators in sql Together
You can combine these operators for better filtering. This helps in real projects.
SELECT*FROM studentsWHERE city IN ('Delhi', 'Mumbai')AND marks BETWEEN80AND95AND name LIKE'K%';
This query filters students step by step. First by city, then by marks, and finally by name.
Why IN BETWEEN LIKE Operators in SQL Matter
These operators make data filtering simple and efficient. Additionally, they reduce complex conditions in queries. Most importantly, they help beginners write professional SQL queries with confidence.
Summary
IN matches multiple values.
BETWEEN filters a range.
LIKE finds patterns in text.
These operators make SQL queries simple and powerful.
Check out our resources!
- Bootstrap Templates: Explore our Bootstrap Projects section.
- Free E-Books: Download your Free E-Books here.


