"MySQL Must know" study _ the seventh chapter _20180730_ Huan

Source: Internet
Author: User

Tag: Execution end also has share Picture nbsp Filter. com must know must be ROM

The seventh chapter: Data filtering

P43

Select Prod_id,prod_price,prod_name from Products where vend_id =1003 and Prod_price <=10; #检索vend_id = 1003 and prod_price<=10 #

Select Prod_name,prod_price from Products where vend_id=1002 or vend_id = 1003; #检索的条件只要满足vend_id =1002, vend_id=1003 can be #

P42

Select Prod_name,prod_price from Products where vend_id =1002 or vend_id=1003 and Prod_price >=10; #and和or同时存在的时候, preferential treatment A nd operator, understood as two conditions: (vend_id=1002) or (vend_id =1003 and Prod_price), to satisfy its one.

P42

Select Prod_name,prod_price from Products where (vend_id =1002 or vend_id =1003) and prod_price>=10; #执行两个命令: (vend_id=1002,vend_id=1003) and prod_price>=10, the command precedence of parentheses () is higher than and and or #

P43 in operator (in take legal value separated by commas, e.g. (5,8))

Select Prod_name,prod_price from Products where vend_id in (1002,1003) order by Prod_name; #检索的条件vend_id within the range of 1002 to 1003 # because vend_id are integers, the result of the above statement is the same as this:

Select Prod_name,prod_price from Products where vend_id=1002 or vend_id=1003 order by Prod_name;

Note, however, that the in command executes faster than OR.

P45

Select Prod_name,prod_price from products where vend_id not in (1002,1003) order by Prod_name; #not否定了not后面的条件, do not retrieve (1002,1003) #

"MySQL Must know" study _ the seventh chapter _20180730_ Huan

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.