- 查询工资最高的员工信息
-- 1 查询最高的工资是多少 9000
SELECT MAX(salary) FROM emp;
-- 2 查询员工信息,并且工资等于9000的
SELECT * FROM emp WHERE emp.`salary` = 9000;
-- 一条sql就完成这个操作。这就是子查询
SELECT * FROM emp WHERE emp.`salary` = (SELECT MAX(salary) FROM emp);
SELECT MAX(salary) FROM emp;
SELECT * FROM emp WHERE emp.`salary` = 9000;
SELECT * FROM emp WHERE emp.`salary` = (SELECT MAX(salary) FROM emp);