#非等值链接
SELECT*from job_grades;
#举例:查询名字、月薪和对应等级
SELECT last_name,salary,grade_level
from employees,job_grades
WHERE employees.salary BETWEEN job_grades.lowest_sal
AND job_grades.highest_sal;
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;
#自连接vs非自连接
SELECT*from employees;
#练习:查询员工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;