限制查询数量
指定排序方向
为了进行降序排序,必须指定DESC关键字
SELECT prod_id, prod_price
FROM products
ORDER BY prod_price DESC;
一个DESC只作用一个列(DESC前面那列),如果多列,必须对每列都指定DESC
SELECT prod_id, prod_price, prod_name
FROM products
ORDER BY prod_price DESC, prod_name;
SELECT prod_price
FROM products
ORDER BY prod_price DESC
LIMIT 1;
检查具有NULL值的列。
SELECT prod_name
FROM products
WHERE prod_price IS NULL;