1,and
2,or
3,and 放下面一行也行,优先级not>and>or,因此本代码其实是筛选1990年1月1日之后出生的人,以及积分大于1000的在VA的人。为了界面简洁,也可以写成
where birth_date>'1990-01-01'or
(points >1000 and state ='VA')
4,1990年1月1日之前出生并且积分大于等于1000的,如果这里的or改为and.就会变成图二
Exercise:
from the order_items table ,get the items
for order #6
where the total price is greater than 30
Solution:
select *
from order_items
where order_id=6 and unit_price*quantity>30