in this command allows us to capture the values in the database within the limits of one or several discontinuous (discrete) values, while the between allows us to use a range (range) to scratch out the values in the database. between The syntax for this clause is as follows:
Select "Field name"
From "Table name"
WHERE "field name" between ' Value one ' and ' value two ';
This will select each of the data that contains the value one and the value two for the field value.
For example, if we were to find all the data from the store_information table in January 6, 1999 and January 10, 1999,
store_information Form
Store_name |
Sales |
Txn_date |
Los Angeles |
1500 |
05-jan-1999 |
San Diego |
250 |
07-jan-1999 |
San Francisco |
300 |
08-jan-1999 |
Boston |
700 |
08-jan-1999 |
We'll break in,
SELECT *
From Store_information
WHERE txn_date between ' jan-06-1999 ' and ' jan-10-1999 ';
Please note: In different databases, the method of storing dates may vary. Here we choose one of the storage methods.
Results:
Store_name |
Sales |
Txn_date |
San Diego |
250 |
07-jan-1999 |
San Francisco |
300 |
08-jan-1999 |
Boston |
700 |
08-jan-1999 |
The results of Linux testing are as follows:
Reprint please indicate the author: Xiao Liu
A concise tutorial of SQL statements for Linux---between