Home >Database >Mysql Tutorial >Oracle 排序之NUll值的排序

Oracle 排序之NUll值的排序

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:22:461128browse

在Oracle官方文档中说明,null值在排序过程是个比较特殊的值类型,默认情况下排序时把它看成了最大值了,也就是说在排序的时候,

背景:排序时候对NULL值的处理,

在Oracle官方文档中说明,null值在排序过程是个比较特殊的值类型,默认情况下排序时把它看成了最大值了,也就是说在排序的时候,,当排序的记录中出现了Null值,默认是,升序排列在最后,反过来在最前,那么也可以程序自己来定义它前后。

1、排在最前:

select xx from student order by xx nulls first;

2、排在最后

select xx from student order by xx nulls last;

然后就搞定了!

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn