4.select_between_ between what and what range

Source: Internet
Author: User

 UseSQL Server;SELECT *  fromEMP;--querying the data in scope--where which--between in ... Between--contains data within the specified range, including the specified condition itselfSelect *  fromEmpwhereSalbetween  -  and 950; --equivalence        Select *  fromEmpwhereSal>=  -  andSal<= 950;--data that does not contain the specified range (including the specified condition itself)Select *  fromEmpwhereSal not between 950  and 1250 ; --equivalence        Select *  fromEmpwhereSal< 950 orSal> 1250 ; --Don't look so troublesome (this is used to see the ascending of the Sal field)        Select *  fromEmpOrder  bySalASC;--Practice    --1. Query for information about all employees with wages between 1500 and 3000 (including the condition itself)        Select *  fromEmpwhereSalbetween  the  and  the Order  bySal; Select *  fromEmpwhereSal>=  the  andSal<= the Order  bySal; --2. Query information for all employees with a salary of less than 3000 or greater than 1500        Select *  fromEmpwhereSal< the orSal> the; --3. Query information for all employees with a salary of less than 3000 and greater than 1500        Select *  fromEmpwhereSalbetween 1501  and 2999--(Your salary didn't send a few cents in it)        Select *  fromEmpwhereSal<  the  andSal>  the; --4. Inquire about all employees who are not paid between 1500 and 3000 (including the conditions themselves)        Select *  fromEmpwhereSal not between  the  and  the Order  bySal; Select *  fromEmpwhereSal<  the orSal>  the Order  bySal; /*Note: Between gets data results that contain its own condition not between get the data does not contain its own condition query what and what can only be used and cannot use or syntax: SEL        ECT * FROM table where field (not) between numeric and value;                The select * from table where field determines the symbolic value;    The select * from table where field determines the symbolic value and (or) field to determine the symbolic value;        Semantics: From table * where * and * (not) between Select property from the field in the table in the value and value (not) query property        For example: SELECT * from emp where Sal is not between and 3000; Explanation: The attribute value from the EMP table, the SAL in 1500 and between 3000, the query meets the requirements field and outputs*/    

4.select_between_ between what and what range

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.