首页 > 数据库技术 > 详细

SQL练习

时间:2015-11-04 17:23:35      阅读:234      评论:0      收藏:0      [点我收藏+]

--18.
create table grade(low number(3),upp number (3),rank char(1));
insert into gGrade values(90,100,‘A‘);
insert into grade values(80,89,‘B‘);
insert into grade values(70,79,‘C‘);
insert into grade values(60,69,‘D‘);
insert into grade values(0,59,‘E‘);

grade表:

技术分享

select SNO,CNO,rank from t_hq_score,grade where DEGREE between low and upp;

技术分享

--19.
select * from t_hq_score where CNO=‘3-105‘and degree >all(select degree from t_hq_score where SNO=‘109‘);

技术分享

--21.
select * from t_hq_score where DEGREE >(select degree from t_hq_score where cno=‘3-105‘and sno=‘109‘);

技术分享

--22.
--最初
select sno,sname,sbirthday from t_hq_student where sbirthday in (select sbirthday from t_hq_student where sno=‘108‘);
--改过后
select sno,sname,sbirthday from t_hq_student where to_char( sbirthday,‘yyyy‘ ) = to_char( (select sbirthday from t_hq_student where sno=‘108‘),‘yyyy‘);

技术分享

--23.
select * from t_hq_score where cno in(select cno from t_hq_course where tno in(select tno from t_hq_teacher where tname=‘张旭‘));

技术分享

--24.
select tname from t_hq_teacher where tno in(select tno from t_hq_course where cno in (select cno from t_hq_score group by cno having count(*)>5));

技术分享

 

SQL练习

原文:http://www.cnblogs.com/zxw0004/p/4936524.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!