实验二_查询语句_ngc

这篇博客展示了多个SQL查询语句的实例,包括选取特定条件的数据、部门薪资汇总、平均奖金排序以及创建视图等操作。内容涵盖员工基本信息、工资详情、市场部门工资以及学生选课情况等,强调了SQL在数据查询和处理中的应用。
摘要由CSDN通过智能技术生成

use pay

select distinct professor from person;
–男员工信息
select no,name,sex,birthday,professor,deptno from person where sex = ‘男’;
–00102女员工信息
select no,name,sex,birthday,professor,deptno from person where deptno=00102 and sex = ‘女’;
–1.5倍工资后实际收入
select base*1.5+bonus-deduct as real_fact from pay where no = ‘000001’;
–00102基本信息
select person.no,name,sex,birthday,professor,deptno,base,bonus,deduct,fact
from person join pay on person.no = pay.no
where person.deptno = 00102
order by fact desc;

select deptno as ‘部门’,sum(fact) as ‘总额’
from pay,person
where pay.no = person.no and year = 2005
group by deptno;
–平均奖金升序排序
select deptname,avg(bonus) as 平均工资 from dept,pay,person
where dept.deptno = person.DeptNo and person.no = pay.no and year = 2005 and month = 1
group by dept.deptno,deptname
having avg(bonus) >

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值