The MySQL Between operator is used to fetch values within a given range. It can be used with SELECT, INSERT, UPDATE and DELETE statement.
To fetch values within a given range, use the following syntax:
Parameters:
tablename: The table name from which you want to perform BETWEEN
operator.
expression: Specifies a column name.
value1 AND value2: To define a range that expression is compared to.
BETWEEN
operator is used to fetch values within a given range i.e. "pk" BETWEEN
1 and 3:
Note:
In the above example, we are fetching values BETWEEN
given range, in abobe example "pk" between 1 and 3.
You can use MySQL Command Line Client to fetch values within a given range. It will look like this: