BETWEEN Operator:
It is used to fetch values which lies within a range given in BETWEEN operator.
Syntax:
SELECT columnname(s)
FROM tablename
WHERE columnname BETWEEN value1 AND value2;
Example:
SELECT * FROM Employee
WHERE Salary BETWEEN 10000 AND 20000;
The above query will fetch those employee details whose salary are between 10000 and 20000.
NOT BETWEEN Operator:
It is used to fetch values which do not lies within a range given in NOT BETWEEN operator, all other tuple which are not in the range of NOT BETWEEN operator will get fetched .
Syntax:
SELECT columnname(s)
FROM tablename
WHERE columnname NOT BETWEEN value1 AND value2;
Example:
SELECT * FROM Student
WHERE Grade NOT BETWEEN 'B' AND 'D';
The above query will fetch those student records whose grade are not between B and D.
0 Comment(s)