In the previous post Create Table Insert Data Into Table and Select Data in SQL, you have learnt how to create a table, insert data into it and
select rows and columns from table. In this post, you will learn how to use BETEEN, NOT BETWEEN, IN and NOT IN operators in SQL.
1- BETWEEN Operator-
BETWEEN operator is used to select rows based on a given range.
You can see example, in which first I have selected all columns and all rows. Second, I have selected marks colum and range is between 64 and 71.
Further, you can see the result.
2- NOT BETWEEN Operator-
NOT BETWEEN operator gives just opposite result of BETWEEN command, see the result below.
3- IN Operator-
Using IN operator you can provide list of selected values from a column, see the result below.
4- NOT IN Operator-
NOT IN operator will give just opposite result as you see using IN operator.
See the result below.