进行升序时候要求数量为null的排在首位:
select name,quantity from productinfo order by quantity nulls first;
进行降序时候要求数量为null的排在末尾:
select name,quantity from productinfoorder byquantity nulls last;
本文介绍了如何在SQL查询中使用`nulls first`和`nulls last`关键字实现数量为NULL值时的升序和降序排序,通过实例演示了操作方法。
进行升序时候要求数量为null的排在首位:
select name,quantity from productinfo order by quantity nulls first;
进行降序时候要求数量为null的排在末尾:
select name,quantity from productinfoorder byquantity nulls last;

被折叠的 条评论
为什么被折叠?