SELECT e.employee_id,e.last_name,d.department_name,l.city
FROM employees e,departments d,locations l
WHERE e.department_id=d.department_id
AND d.location_id=l.location_id;
SELECT * FROM employees;
#查询名字、月薪和对应的等级
SELECT e.last_name,e.salary,j.grade_level
FROM employees e,job_grades j
WHERE e.salary BETWEEN j.lowest_sal AND j.highest_sal;
SELECT e.last_name,e.salary,j.grade_level
FROM employees e,job_grades j
WHERE e.salary >=j.lowest_sal AND e.salary<=j.highest_sal;
#2.自连接(自我引用)vs 非自连接、
#查询员工id,姓名以及管理者Id和姓名
SELECT emp.employee_id,emp.last_name,mgr.employee_id,mgr.last_name
from employees emp,employees mgr
WHERE emp.manager_id=mgr.employee_id;