• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
June's New World
知识和经验都是一点点积累的!现在努力也不晚,June加油!
博客园    首页    新随笔    联系   管理    订阅  订阅
一个数据库小题目

写SQL,学生表student(studentid,name)

绩表score(scoreid,studentid,score)

求出平均成绩大于60 且 至少有两门成绩高于70分的学生的编号和姓名

/*
学生表student(studentid,name)
绩表score(scoreid,studentid,score)
求出平均成绩大于60 且 至少有两门成绩高于70分的学生的编号和姓名
*/
select studentid, name 
from student 
where studentid in
(
select studentid
from score
where studentid in (select studentid from score where  score>65  group by studentid  having count(studentid)>=2 )
group by studentid
having avg(score)>60 
)
posted on 2011-07-15 13:06  冬雨在路上  阅读(384)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3