USE myemployees;
SELECT * FROM employees;
SELECT *
FROM employees
ORDER BY salary DESC;
SELECT *
FROM employees
ORDER BY salary;
SELECT *
FROM employees
WHERE department_id >=90
ORDER BY hiredate ASC;
SELECT *,salary*(1+IFNULL(commission_pct,0))*12 AS 年薪
FROM employees
ORDER BY salary*(1+IFNULL(commission_pct,0))*12 DESC;
SELECT *,salary*(1+IFNULL(commission_pct,0))*12 AS 年薪
FROM employees
ORDER BY 年薪 DESC;
SELECT CONCAT(last_name,first_name) AS 姓名,
salary,
LENGTH(last_name)+LENGTH(first_name) AS 长度
FROM employees
ORDER BY 长度 ASC;
SELECT *
FROM employees
ORDER BY salary ASC ,employee_id DESC;
SELECT CONCAT(last_name,first_name) AS 姓名,
department_id,
salary*(1+IFNULL(commission_pct,0))*12 AS 年薪
FROM employees
ORDER BY 年薪 DESC,last_name ASC;
SELECT CONCAT(last_name,first_name) AS 姓名,
salary
FROM employees
WHERE salary NOT BETWEEN 8000 AND 17000
ORDER BY salary DESC;
SELECT *
FROM employees
WHERE email LIKE '%e%'
ORDER BY LENGTH(email) DESC,department_id ASC;
|