1、查询价格不是800的所有商品(where/!=)
SELECT * FROM product WHERE price != 800
2、查询商品价格在200到1000之间所有商品(between)
SELECT * FROM product WHERE price BETWEEN 200 AND 1000;
SELECT * FROM product WHERE price >= 200 AND price <=1000;
3、查询商品价格是200或800的所有商品(or、in)
SELECT * FROM product WHERE price = 200 OR price = 800;
SELECT * FROM product WHERE price IN (200,800);
4、查询含有’霸’字的所有商品(like)
SELECT * FROM product WHERE pname LIKE '%霸%'
SELECT * FROM product WHERE pname LIKE '_想%'--第二个字为想的
SELECT * FROM product WHERE pname LIKE '香%';--以香开头的
5、查询有分类的商品(null)
SELECT * FROM product WHERE category_id IS NOT NULL