where shop_price>300 and shop_price<500where shop_price<300 or shop_price>500
where shop_price between 300 and 500
where shop_price >= 300 and shop_price <= 500
where cat_id in(4,5,6)cat_id=4 cat_id=5 cat_id=6
group by 需要配合一下5个聚合函数使用:
select cat_id.max(shop_price) from goods group by cat_id;
having必须作用于where之后
select cat_id,sum(shop_price*goods_number) as huokuan from goods group by cat_id having huokuan>20000;
limit[偏移量],条数
偏移量默认为0