sql中的排序,如何使用倒序

sql中的排序,如何使用倒序,第1张

sql中的排序使用倒序的步骤如下:

我们需要准备的材料分别是:电脑、sql查询器。

1、首先,打开sql查询器,连接上相应的数据库表,例如test表,以score字段倒序为例。

2、点击“查询”按钮,输入:select * from test order by score desc。

3、点击“运行”按钮,此时会发现score字段按倒序排序查询出了。

//搜索前10条记录 

 

select * from table limit 10 

 

//倒序排列----以id做排序

 

select * from table order by id desc 

//正序排列----以id号排序

 

select * from table order by id asc 

 

//搜索前10条记录并倒序排列 

 

select * from table order by id desc limit 10 

 

//limit 要放在后面


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/10826993.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-11
下一篇 2023-05-11

发表评论

登录后才能评论

评论列表(0条)

保存