SQL里面的排序语句desc和ASC有什么区别
发布日期:2021-05-07 19:14:22 浏览次数:23 分类:精选文章

本文共 239 字,大约阅读时间需要 1 分钟。

SQL 语句中, asc是指定列按升序排列,desc则是指定列按降序排列。

排序子句语法:order by 列名 asc/desc

例表格:tt

1、按列n2的升序排列

1

select * from tt order by n2 asc;

2、按列n2的降序排列

1

select * from tt order by n2 desc;

3、复合排序,先按列n1升序排列,再按n2降序排列

1

select * from tt order by n1 asc,n2 desc;

上一篇:百度搜索之site 使用
下一篇:mysql 日常使用语句记录

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2025年04月18日 15时54分16秒