Why is it that when we have a NULL value in a column and we order by the value ascending, the NULLs are sorted first?
select 1 as test union all select 2 union all select NULL union all select 3 union all select 4 order by test
NULL 1 2 3 4
I keep thinking that NULL meant "Indeterminant" or possible "Unknown". If that's true, wouldn't they sort last, since the value could be greater than all other values? (Or is this a sorting option somewhere?)
I'm on SQL Server 2008R2, but I suspect this is true across all SQL Servers, and probably across all RDBMSs.