in操作符 和 not 操作符
如果取出多个值,可以在where使用in 后面使用() 括起来,括号里面的值用逗号隔开,例子如下:
select goods_name,shop_price from goods where shop_price in (280,5999,95);
+-----------------+------------+ | goods_name | shop_price | +-----------------+------------+ | 三星BC01 | 280.00 | | 多普达Touch HD | 5999.00 | | 联通100元充值卡 | 95.00 | +-----------------+------------+
其中 in的操作符和or的功能完全一样
select goods_name,shop_price from goods where shop_price in (60,75); 和下面的语句取出的结果一样 select goods_name,shop_price from goods where shop_price = 60 or shop_price =75 ;
not操作符只有一个功能就是否定它之后所跟的任何条件
mysql> select goods_name,shop_price from goods where cat_id=2 and shop_price not in (18,90); 例如此语句代表 shop_price不是18 也不是90 +--------------+------------+ | goods_name | shop_price | +--------------+------------+ | 恒基伟业G101 | 823.33 | +--------------+------------+

浙公网安备 33010602011771号