Mysql之运算的使用


比较运算符

 Select shohin_mei,shohin_bunrui from shohin where hanbai_tanka 500;

--选出列为500的记录


 Select shohin_mei,shohin_bunrui from shohin where hanbai_tanka <> 500;

--选出列不是500的记录

 

可以使用的比较运算符<>>=><=<


Select shohin_id,shohin_bunrui from shohin where hanbai_tanka >= 1000;

 Ps:注意不能对NULL进行比较运算符。

---选取不为NULL的记录

Select shohin_mei,shiire_tanka from shohin where shiire_tanka is not NULL;

 

逻辑运算符


NOT:select shohin_mei,shohin_bunrui from Shohin where not banbai_tanka >= 1000;

And&&) 与OR||


Select shohin_mei,shiire_tanka from shohin where shohin_bunrui = ‘厨房用具’ and hanbai_tanka >= 3000;


Select shohin_mei,shiire_tanka from shohin where shohin_bunrui = ‘厨房用具’ or hanbai_tanka >= 3000;


Select shohin_mei,shohin_bunrui,torokubi from shohin 

Where shohin_burui = ‘日用品’ and ( torokubi = ‘2009-09-11’ or torokubi = ‘2009-09-20’);

----这里()的优先级是大于and的,而and单独的优先级是大于or

 

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值