数据库
首页 > 数据库> > MySQL-sql99语法-非等值连接

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

标签:salary,等值,sal,grade,level,个数,sql99,MySQL,工资级别
来源: https://www.cnblogs.com/jgg54335/p/14960585.html