admin管理员组

文章数量:1531240

2024年6月14日发(作者:)

Order by的几种用法

1. 按列名排序,默认是升序的。

单歹 0 升序: select from order by ;

单歹 0 降序: select from table_name order by desc;

多歹 0 升序: select , from table_name order by ,;

多歹 0 降序: select , from order by desc, desc;

多 列混合 降序: select column_one, column_two from

table_name order by column_one desc, column_two desc;

2. 按列的位序排序,默认是升序

select * from order by 1

3. NULL排序

空值在前:select from order by NULLS FIRST;

空值在后: select from order by

NULLS LAST;

本文标签: 排序默认升序降序位序