Posted in 面试题 onJune 16, 2013
1. 按列名排序,默认是升序的。
单列升序:select from order by ;
单列降序:select from table_name order by desc;
多列升序:select, from table_name order by , ;
多列降序: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;
单列升序:select
单列降序:select
多列升序:select
多列降序:select
多列混合降序:select column_one, column_two from table_name order by column_one desc, column_two desc;
2. 按列的位序排序, 默认是升序
select * from
3. NULL排序
空值在前:select
空值在后:select
Order by的几种用法
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Tags in this post...
Reply on: @reply_date@
@reply_contents@