Linux SQL statement concise tutorial --- BETWEEN, concise tutorial ---

Source: Internet
Author: User

Linux SQL statement concise tutorial --- BETWEEN, concise tutorial ---

INThis command allows us to capture the values in the database according to the limit of one or more non-consecutive (discrete) values.BETWEENSo that we can use a range to capture values in the database.BETWEENThe syntax of this clause is as follows:

SELECT "column name"
FROM "table name"
WHERE "column name" between' value: 'and' value: 2 ';

This will include every piece of information between value 1 and value 2.

For exampleStore_InformationFind all the information in January 6, 1999, and January 10,199,

Store_InformationTable

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

Let's get,

SELECT *
FROM Store_Information
WHERE Txn_Date BETWEEN 'Jan-06-1999 'AND 'Jan-10-1999 ';

Note: in different databases, the date storage method may be different. Here we chose one of the storage methods.

Result:

Store_Name Sales Txn_Date
San Diego 250 07-Jan-1999
San Francisco 300 08-Jan 1999
Boston 700 08-Jan 1999


The test results for Linux are as follows:


Reprinted by Liu

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.