BETWEEN Condition


 

 

SQLite: BETWEEN Condition

This SQLite tutorial explains how to use the SQLite BETWEEN Condition with syntax and examples.

 

Description:
The SQLite BETWEEN Condition is used to retrieve values within a range in a SELECT, INSERT, UPDATE, or DELETE statement.

 
Syntax:

 

Parameters or Arguments:

expressions

A column or calculation.

value1 and value2

These values create an inclusive range that expression is compared to.

Note: The SQLite BETWEEN Condition will return the records where expression is within the range of value1 and value2 (inclusive).

 

Examples:

  • The following SQLite statement selects all salaries BETWEEN 40000 and 60000:

    id salary account_no emp_id
    2 60000 1001 101
    3 40000 1002 102
  • The following SQLite statement selects all salaries NOT BETWEEN 40000 and 60000:

    id salary account_no emp_id
    1 30000 1000 100
    4 35000 1003 103
    5 35000 1004 104
    6 5000 105
    7 5000 106
  • The following SQLite statement selects all name beginning with any of the letter NOT BETWEEN ‘c’ and ‘m’:

    id name position hire_date
    101 arunesh manager 1/1/2012
    102 naga Team Lead 1/1/2013
    103 nithya developer 6/1/2013
    105 uma designer 1/1/2013
    106 mathu research analyst 1/1/2013
    107 anitha research analyst 1/1/2014