#案例:查询员工的工资级别

SELECT
    salary,grade_level
FROM
    employees e
JOIN
    job_grades g
ON
    e.`salary` BETWEEN g.`lowest_sal` AND g.`lowest_sal`;

#案例:查询每个工资级别的个数,并且按级别降序

SELECT
    COUNT(*),grade_level
FROM
    job_grades j
JOIN
    employees e
ON
    e.`salary` BETWEEN j.`lowest_sal`AND j.`highest_sal`
GROUP BY
    grade_level DESC;