MySQL-sql99语法-非等值连接

非等值连接

查询员工的工资级别

# 非等值连接
# 查询员工的工资级别
select `salary`,`grade_level`
from `job_grades` g
inner join `employees` e
on e.`salary` between g.`lowest_sal` and g.`highest_sal`;

image

查询工资级别的个数>2的个数,并且按工资级别降序

# 查询工资级别的个数>2的个数,并且按工资级别降序
select COUNT(*),`grade_level`
from `job_grades` g
inner join `employees` e
on e.`salary` between g.`lowest_sal` and g.`highest_sal`
group by grade_level
having count(*)>20
order by grade_level desc;

image

posted @ 2022-05-23 13:23  司砚章  阅读(108)  评论(0)    收藏  举报