12_MySQL如何对查询结果进行排序

 

本节所涉及的sql语句:

-- 排序关键字

SELECT empno,ename,hiredate FROM t_emp ORDER BY hiredate DESC;

-- 排序字段相同的情况

SELECT empno,ename,sal,hiredate FROM t_emp ORDER BY sal ASC,hiredate DESC;

SELECT empno,ename,sal,hiredate FROM t_emp ORDER BY sal ASC LIMIT 5;

 

 

 

 

 此时字段sal是无序的

 

 

 

 此时sal就变得有序了

 

 

 

 

 

 

 

 

posted @ 2020-11-10 18:25  止一  阅读(651)  评论(0编辑  收藏  举报