您的位置:首页 > 数据库

数据库系统概念 读书笔记(六)

2017-08-01 17:13 239 查看
select course_id,semester,year,sec_id,avg(tot_cred)
from takes natural join student
where year=2009
group by course_id,semester,year,sec_id
having count(id)>=2


查询2009年的讲授的每个课程,并且至少有2名学生上课,找出选修该课程的所有学生的总学分的平均分

select name
from instructor
where salary>some/all(select salary
from instructor
where dept_name='Biology')


查出比生物系任意一个(全部)老师工资高的所有老师的姓名

delete from r
where p


从r表里删除条件为p的

update instructor
set salary = salary*1.05
where salary<(select avg(salary)
from instructor)


对工资低于平均工资的教师涨薪5%

update instructor
set salary= case
when salary<=100000 then salary*1.05
else salary*1.03
end


提供了顺序。工资低于10w的涨5%,高出的涨3%。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: