What is the difference between BETWEEN and IN operators in SQL ?
|
BETWEEN |
IN |
|
This condition allows you to check if given values are in the specified range.
|
In operator is used for matching values in the given list of values.
|
| Values can be text, date or numbers.
|
In operator can be used to remove multiple or condition in select, Insert, update, or delete.
|
| Between commands can be used in Select, Insert, update or delete.
|
Not In is used to exclude rows in the list. |
| This condition will return records between the range of values 1 and 2.
|
Duplicate entries are retained.
|
| Syntax:
SELECT Fname, Lname FROM Employee WHERE Salary BETWEEN 30000 AND 45000;
|
Syntax: SELECT Fname, Lname FROM Employee WHERE Salary IN (30000, 40000, 25000);
|
