设为首页 加入收藏

TOP

第二套数据库笔试题及答案(四)
2014-11-24 01:01:26 来源: 作者: 【 】 浏览:48
Tags:第二 数据库 试题 答案
sum(r.r_fenshu) as 总分
from results r inner join students s on r.r_stid =s.st_id
where s.st_name = ‘王楠’
9.select distinct s.st_id,s.st_name
from students s inner join results r on s.st_id = r.r_stid
where st_id not in (select r_stid from results where r_fenshu<60) and st_id not in (select r_stid from results where r_fenshu >=90)


10 update results
set r_fenshu = r_fenshu + 10
–如果分数不可能大于100请用这句 set r_fenshu = case when r_fenshu + 10 <=100 then r_fenshu + 10 else 100 end
where r_stid in (select st_id from students where sex=’女’)


1 进阶题
select t.t_name,count(*)
from students s,teachers t,results r
where r.r_tid = t.t_id
and s.st_id =r.r_stid
and r.r_fenshu >= 60
and t.t_id in (select t_id from teachers where t_lesson=’数学’ )
–and t_lesson=’数学’
group by t.t_name


2


select top 1 sum(r_fenshu) as 总分,t.t_lesson,t_id,t_name
from results r,teachers t
where r.r_tid = t.t_id
group by t.t_lesson,t_id,t_name
order by 总分 desc


3. delete from results where r_stid in (select r_stid from results group by r_stid having count(r_tid) = 1)


首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇恩世教育笔试题 下一篇雅迅网络的上机题

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: