Oracle considers null to be the largest. Sort in ascending order. By default, the null value is placed behind. Sort in descending order. By default, the null value is ranked first. How to change the null value: (1) Use the nvl function or decode function to convert null to a specific value and replace null: nvl (arg, value) (2) use case syntax to convert null to a specific value (later than oracle9i
Oracle considers null to be the largest. Sort in ascending order. By default, the null value is placed behind. Sort in descending order. By default, the null value is ranked first. How to change the null value: (1) Use the nvl function or decode function to convert null to a specific value and replace null: nvl (arg, value) (2) use case syntax to convert null to a specific value (later than oracle9i
Oracle considers null to be the largest.
Sort in ascending order. By default, the null value is placed behind.
Sort in descending order. By default, the null value is ranked first.
How to change the null value:
(1) Use the nvl function or decode function to convert null to a specific value.
Replace null: nvl (arg, value)
(2) Use case syntax to convert null to a specific value (later than oracle9i. Similar to sqlserver ):
Order by (case mycol when null then 'Beijing drioker' else mycol end)
(3) Use nulls first or nulls last syntax.
Null Value sorting syntax
Nulls first: Place null at the top. For example:
Select *
From mytb
Order by mycol nulls first
Null last: the last line of null. For example:
Select *
From mytb
Order by mycol nulls last
Sqlserver considers null to be the smallest.
Sort in ascending order: null values are ranked first by default.
Order by case when col is null then 1 else 0 end, col
Sort in descending order: the null value is ranked last by default.
Order by case when col is null then 0 else 1 end, col desc
Replace null: isnull (arg, value)