||
#降序SELECT id,name FROM dish ORDER BY id DESC;#升序SELECT id,name FROM dish ORDER BY id ASC;
如果在ORDER BY 后面没有声明排序方式,默认按升序排序
SELECT id,name,price *2 两份饭钱 FROM dish ORDER BY 两份饭钱 ;
<img src="https://img-blog.csdnimg.cn/dbda7bd3c1ed4efd98a011cbca2a626f.png" alt="在这里插入图片描述" data-href="" style=""/>
SELECT id,name,price FROM dish ORDER BY price DESC,name ASC;
<img src="https://img-blog.csdnimg.cn/2a0c4a1896a14f5eb28b9a004eca8921.png" alt="在这里插入图片描述" data-href="" style=""/>
SELECT id,name,price FROM dish LIMIT 0,20 ;
<img src="https://img-blog.csdnimg.cn/9d663bc0c1b34c4295995aacdf0965c2.png" alt="在这里插入图片描述" data-href="" style=""/>
LIMIT 31,2
LIMIT...OFFSET...两个参数互换即可
LIMIT 2 OFFSET 31
WHERE->ORDER BY->LIMIT
合作电话:010-64087828
社区邮箱:greatsql@greatdb.com