#1.查询员工的姓名和部门和年薪,按年薪降序,按姓名升序
SELECT
last_name,department_id,12*salary*(1+IFNULL(commission_pct,0)) AS 年薪
FROM
employees
ORDER BY
年薪 DESC,last_name ASC;
#2.选择工资不在8000到17000的员工的姓名和工资,按工资降序
SELECT
last_name,salary
FROM
employees
WHERE
#salary not between 8000 and 17000
salary < 8000 OR salary > 17000
ORDER BY
salary DESC;
#3.查询邮箱中包含 e 的员工信息,并按邮箱的字节数降序,再按部门编号升序
SELECT
*
FROM
employees
WHERE
email LIKE '%e%'
ORDER BY
LENGTH(email) DESC,department_id ASC;