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`;

查询工资级别的个数>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;

转载请注明出处,欢迎讨论和交流!

浙公网安备 33010602011771号