SQL between and range operations

Source: Internet
Author: User

SQL between and range operations

Keywords allow you to define predicates in various forms. If the value of a column in a row falls within this range, the predicate is true, which is said in the result table. The scope of the test, between two keywords and and. It must provide the upper and lower range values. The first value must be the lower bound and the upper limit of the second value.

The syntax of this clause between is as follows:

SELECT column_name
From derived_table
WHERE column_name [NOT] BETWEEN ' value1 ' and ' value2 '

This retrieves the columns of all rows with the ' value of 1 ' and ' value '. Clauses can be used in any valid SQL statement-SELECT, INSERT, UPDATE, or delete. It is important to note that it can treat different database tutorials differently.

Instance One

SELECT Employeeidno, Salary
From employeestatisticstable
WHERE Salary BETWEEN 30000 and 50000

Example Two

SELECT Employeeidno, Salary
From employeestatisticstable
WHERE Salary not BETWEEN 30000 and 50000

Example Three

SELECT *
From employeeaddresstable
WHERE LastName BETWEEN ' Ackerman ' and ' Scott '

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.