数据库排序空字段如何往后排

Oracle数据库(亲测有效):

  空字段排在最前:order by name nulls first;

  空字段排在最后:order by name nulls last;

Mysql数据库(暂未测试):

  select * from user u order by u.orderid is null, u.orderid

原文地址:https://www.cnblogs.com/guyaoblog/p/10320200.html