SELECT * FROM job_grades;
-- 一、非等值连接
#rei: 查询名字,月薪和对应等级
-- 1. BETWEEN AND 的方法
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;
-- 2.比较号的方法
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;
-- 二、自连接
-- rei: 查询员工id员工姓名及管理者id与姓名
SELECT empl.employee_id,empl.last_name,mgr.employee_id,mgr.last_name
FROM employees empl,employees mgr
WHERE empl.manager_id = mgr.employee_id;