SQL BETWEEN operator is basically used to select the values within a range. The values can be text, numbers, or dates. Here is the general form of the BETWEEN operator in SQL:
SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2;
Here is an example of BETWEEN operator in SQL. Consider the following table CUSTOMERS having the records:
The following SQL statement selects all the columns of the table CUSTOMERS whose salary in between 76000 and 86000:
SELECT * FROM customers WHERE salary BETWEEN 76000 AND 86000;
After querying the above SQL statements, you will get the following output:
© Copyright 2021. All Rights Reserved.