SQL练习
2015-11-04 16:59
429 查看
--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));
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 编程你也行】SQL Server 2012新功能之函数:转换函数
- IBatis.Net使用总结(一)-- IBatis解决SQL注入(#与$的区别)
- redis的几个命令
- INTEGER PRIMARY KEY AUTOINCREMENT 和 INTEGER PRIMARY KEY 区别
- MYSQL主从不同步延迟原理分析及解决方案
- redis3在debian8.2下安装
- MYSQL主从不同步延迟原理分析及解决方案
- Sqlite 3总结
- 【MySQL】sync_binlog innodb_flush_log_at_trx_commit 浅析
- MySQL安装-数据初始化操作时的问题处理
- Sql Server 日常管理
- mysql mysql的innodb_flush_log_at_trx_commit参数深有体会
- SQL中的JOIN和UNION的用法
- spark sql
- PostgreSQL表的行数统计
- 【转】iOS开发—SQLite的简单使用
- MongoDB 查询非空数组
- Ibatis 动态条件SQL语句
- 不同数据库自增字段的创建实现举例
- 另一套Oracle SQL练习题,更新参考答案