Syntax of BETWEEN in SQL-
SELECT(ColumnName(s))
FROM <TableName>
WHERE<ColumnName>
BETWEEN value1 AND value2;
Example of BETWEEN in SQL-
SELECT *
FROM Products
WHERE Price
BETWEEN 18 AND 22;
–It will select all the products with a price between 18 to 22.
Syntax of NOT BETWEEN in SQL-
SELECT(ColumnName(s))
FROM <TableName>
WHERE<ColumnName>
NOT BETWEEN value1 AND value2;
Example of NOT BETWEEN in SQL-
SELECT *
FROM Products
WHERE Price
NOT BETWEEN 18 AND 22;
–It will select all the products with a price not between 18 to 22.
Note-
Northwind sample database is used for example.