Range in SQL
Written By:- Isha MalhotraRange operators are those operators which selects data according to particular range. There are two type of range operator and these are following:-
Between Operator
Between operator is used to select the data between any range.
Example of Range Operator
select * from prod_rep where No_of_Prod between 1000 and 1200;
In this example it will select data between 1000 and 1200.
Note:-between operator include the range also. It means it will also select those data which contain 1000 and 1200.
The output of this query is as follows:-
Figure 1
Not Between
Not between operator works opposite the between. It will select all data except those which will be not in given range.
select * from prod_rep where No_of_Prod not between 1000 and 1200;
The output of this query is as follows:-
Figure 1
It selects all data which does not fall in this range which is 1000 to 1200