where 与 having 的区别
where是对数据直接处理,having是对产生的结果再进行处理
select goods_id,goods_name,market_price-shop_price as k from goods where market_price-shop_price >200;
上语句只能使用
where market_price-shop_price>200 而不能使用 where k >200;
但是对于having 来说如下
select goods_id,goods_name,market_price-shop_price as k from goods having k >200;