您的位置:首页 > 数据库 > MySQL

MySQL学习4 数据过滤

2017-02-22 16:43 316 查看
and 和 or 操作符

select prod_name ,prod_price
form products
where vend_id =1002 or vend_id=1003 and prod_price >=10; #这样会先处理 and部分的内容,再处理or的内容
例2
select prod_name ,prod_price
form products
where( vend_id =1002 or vend_id=1003) and prod_price >=10;
in 操作符
select prod_name , prod_price
form products
where vend_id in (1002,1003) #会与括号中的值逐个匹配,实际效果与 where vend_id = 1002 or vend_id=1003一样
order by prod_name;
not操作符
not操作符就是否定后面的任何条件
select prod_name , prod_price
form products
where vend_id not in (1002,1003)
order by prod_name;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  where products