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