Oracle的排序查询

---------排序查询

/*

语法: SELECT * |列名

FROM 表名

{WEHRE 查询条件}

ORDER BY 列名 1 ASC【升序】|DESC【降序】,列名 2...ASC|DESC

*/

 

-- 范例:查询雇员的工资从低到高

select*from emp orderby sal asc;

select*from emp orderby sal;

 

--范例: 查询员工的奖金有小到大

select*from emp orderby comm ;

 

--范例: 查询员工的奖金有大到小

-- 空值的排序:我们使用 nulls last【最后】|first【最前】

select * from emp order by comm desc   nulls   last ;

猜你喜欢

转载自blog.csdn.net/weixin_42261037/article/details/80946740
今日推荐