前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >2018-06-03-oracleTest

2018-06-03-oracleTest

作者头像
杨校
发布2018-12-06 10:37:15
3450
发布2018-12-06 10:37:15
举报
文章被收录于专栏:Java技术分享圈

Oracle实验练习题

  1. 查询Student表中的所有记录的Sname、Ssex和Class列。 select sname ,sex,sclass from student;
  2. 查询教师所有的单位即不重复的Depart列。 select distinct t.depart from teacher t;
  3. 查询Student表的所有记录 select * from student;
  4. 查询Score表中成绩在60到80之间的所有记录。 select * from score sc where degree between 60 and 80; select * from score sc where degree >= 60 and degree <= 80;
  5. 查询Score表中成绩为85,86或88的记录。 select * from score where degree in (85,86,88); select * from score where degree = '85' or degree ='86'or degree = '88');
  6. 查询Student表中“95031”班或性别为“女”的同学记录 select * from student where sclass ='95031' and ssex= '女';
  7. 以Class降序查询Student表的所有记录。 select * from student order by sclass desc;
  8. 以Cno升序、Degree降序查询Score表的所有记录 select * from score sc order by sc.sno asc ,sc.degree desc;
  9. 查询“95031”班的学生人数。 select s.sclass 总人数 from student s where sclass = '95031';
  10. 查询Score表中的最高分的学生学号和课程号。(子查询或者排序) select sc.sno,sc.cno from score sc order by degree desc;
  11. 查询Score表中至少有5名学生选修的并以3开头的课程的平均分数。 select cno, avg(degree) from score where cno like '3%' group by cno having count(1)>=5 ;
  12. 查询所有学生的Sname、Cno和Degree列 select s.sname,sc.cno,sc.degree from score sc,student s where sc.sno=s.sno;
  13. 查询所有学生的Sno、Cname和Degree列 select s.sno,t.degree,c.cname from score sc,student s,course c where sc.sno=s.sno and sc.cno =c.cno;
  14. 查询所有学生的Sname、Cname和Degree列 select s.sname,t.degree,c.cname from score t,student s,course c where t.sno=s.sno and t.cno =c.cno;
  15. 查询“张旭“教师任课的学生成绩。 select t.tno,c.cno,c.cname,s.degree from TEACHER t join course c on t.tno =c.tno join score s on c.cno =s.cno where t.tname='张旭';
  16. 查询选修某课程的同学人数多于5人的教师姓名。 select tname from teacher e join course c on e.tno=c.tno join(select cno from SCORE group by cno having count(cno)>5) t on c.cno=t.cno ;
  17. 查询和学号为108的同学同年出生的所有学生的Sno、Sname和Sbirthday列。 select sno,sname,sbirthday from student where to_char(sbirthday,'yyyy')=(select to_char(t.sbirthday,'yyyy') from STUDENT t where sno='108')
  18. 查询和学号为108的同学同年出生的所有学生的Sno、Sname和Sbirthday列。 select cno from SCORE t where degree>85 group by cno
  19. 查询出“计算机系“教师所教课程的成绩表 select t.sno,t.cno,t.degree from SCORE t join course c on t.cno=c.cno join teacher e on c.tno=e.tno where e.depart ='计算机系';
  20. 查询“计算机系”与“电子工程系“不同职称的教师的Tname和Prof select tname,prof from teacher where depart ='电子工程系' and prof not in(select prof from teacher where depart ='计算机系') or depart ='计算机系' and prof not in(select prof from teacher where depart='电子工程系'); select tname,prof from teacher where prof not in( select a.prof from (select prof from teacher where depart ='计算机系') a join (select prof from teacher where depart='电子工程系') b on a.prof =b.prof )
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018年06月03日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Oracle实验练习题
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档