#1.选择工资不在8000-17000的员工的姓名和工资,按工资降序
SELECT
last_name,salary
FROM
employees
ORDER BY salary DESC;
#2.查询邮箱中包含e的员工信息,并按邮箱的字节数降序,再按部门号升序
SELECT
*
FROM
employees
ORDER BY LENGTH(email)DESC,department_id ASC;
#3.查询员工的姓名和部门号和年薪,按年薪降序 按姓名升序
SELECT
last_name,salary*12*(1-IFNULL(commission_pct,0)) AS 年薪
FROM
employees
ORDER BY
年薪 DESC,last_name ASC;
order by排序
最新推荐文章于 2024-01-17 16:10:13 发布