Article Directory
in conclusion
- Use keywords
nulls first/last
to treatment.nulls first:
The record representing the null value will be ranked first (whether it is asc or desc)nulls last:
The record representing the null value will be ranked last (whether it is asc or desc)
SELECT t.* FROM scott.emp t ORDER BY t.comm NULLS FIRST; -- null 值在最前面
SELECT t.* FROM scott.emp t ORDER BY t.comm NULLS LAST; -- null 值在最后面
Please note
Default:, null 默认为最大值
namely:
- Asc (ascending order), it is ranked last
- In desc (descending order), rank first