SQL Between operator is utilized to include both end values specified. It can be used for checking a range of values. Between operator can be used in Select, Update, Delete, Insert statements. The AND key word must be used between two limit values. The BETWEEN Condition will give back the records where expression is inside the scope of esteem-1 and esteem-2 comprehensively.
Conceptual
figure
SQL Between Syntax
Syntax
The syntax for SQL Between operator is as follows
Select * from <table_name> where <column_name> between Min and Max;
Table name =>The accurate table name in the database.
Column name =>The operations that can be performed on a column.
Examples
The below example describe the execution of Between operator.
[c]sql> select * from employee;
+--------+--------+--------+
| emp_id | ename | salary |
+--------+--------+--------+
| 1001 | Mike | 15000 |
| 1002 | Martin | 16000 |
| 1003 | Jack | 17000 |
| 1004 | James | 18000 |
| 1005 | Kite | 19000 |
+--------+--------+--------+
5 rows in set (0.00 sec)
sql> select * from employee where salary between 16000 and 18000;
+--------+--------+--------+
| emp_id | ename | salary |
+--------+--------+--------+
| 1002 | Martin | 16000 |
| 1003 | Jack | 17000 |
| 1004 | James | 18000 |
+--------+--------+--------+
3 rows in set (0.00 sec)
sql> select * from employee where salary between 15000 and 17000;
+--------+--------+--------+
| emp_id | ename | salary |
+--------+--------+--------+
| 1001 | Mike | 15000 |
| 1002 | Martin | 16000 |
| 1003 | Jack | 17000 |
+--------+--------+--------+
3 rows in set (0.00 sec)[/c]
By viewing the above example, the concept of Between operator will be understood.
Summary
Key Points
SQL Between Operator - Between operator is used to retrieve the values between minimum and maximum range of an expression.