BETWEEN and NOT BETWEEN Keywords
The BETWEEN keyword defies a range of values the record must fall into to make the condition true. The range may include an upper value and a lower value between which the criteria must fall into.
SELECT Admno, Name, Age, Gender FROM Student WHERE Age BETWEEN 18 AND 19;
Admno |
Name |
Gender |
Age |
Place |
101 |
Adarsh |
M |
18 |
Delhi |
103 |
Ayush |
M |
18 |
Delhi |
104 |
Abinandh |
M |
18 |
Chennai |
105 |
Revathi |
F |
19 |
Chennai |
106 |
Devika |
F |
19 |
Bangalore |
The NOT BETWEEN is reverse of the BETWEEN operator where the records not satisfying the condition are displayed.
SELECT Admno, Name, Age FROM Student WHERE Age NOT BETWEEN 18 AND 19;
Admno |
Name |
Age |
101 |
Ashish |
17 |
102 |
Akshith |
17 |
107 |
Hema |
17 |