【Oracle 結論】 函數
order by colum asc 時,null默認被放在最後排序
order by colum desc 時,null默認被放在最前table
nulls first 時,強制null放在最前,不爲null的按聲明順序[asc|desc]進行排序ast
nulls last 時,強制null放在最後,不爲null的按聲明順序[asc|desc]進行排序 date
【MySql 結論】select
order by colum asc 時,null默認被放在最前tab
order by colum desc 時,null默認被放在最後co
ORDER BY IF(ISNULL(update_date),0,1) null被強制放在最前,不爲null的按聲明順序[asc|desc]進行排序ab
ORDER BY IF(ISNULL(update_date),1,0) null被強制放在最後,不爲null的按聲明順序[asc|desc]進行排序
組函數AVG()算NULL值:select AVG(IFNULL(field,0)) from table;