select 练习4
21、查询score中选学多门课程的同学中分数不是所有成绩中最高分成绩的记录。
select * from score where cno in(select cno from score group by cno having count(1)>1) and degree<>(select max(degree) from score);

24、查询选修某课程的同学人数多于5人的教师姓名。
select t.tname from teacher t join course c on t.tno = c.tno where c.cno in (select cno from score group by cno having count(1)>5);

26、 查询存在有85分以上成绩的课程Cno.
select cno from score where degree in (select degree from score group by degree having degree>85);

27、查询出“计算机系“教师所教课程的成绩表。
select s.* from score s join course c on s.cno = c.cno join teacher t on t.tno = c.tno where t.depart = '计算机系';

28、查询“计算机系”与“电子工程系“不同职称的教师的Tname和Prof。
select t.tname,t.prof from teacher t where t.prof in(select t.prof from teacher t group by t.prof having count(1)=1)

29、查询选修编号为“3-105“课程且成绩至少高于选修编号为“3-245”的同学的Cno、Sno和Degree,并按Degree从高到低次序排序。
select cno,sno,degree from score where cno='3-105'
and degree>=(select min(degree) from score where cno='3-245') order by degree desc;

30、查询选修编号为“3-105”且成绩高于选修编号为“3-245”课程的同学的Cno、Sno和Degree.
select cno,sno,degree from score where cno='3-105' and degree> (select max(degree) from score where cno='3-245');

31、 查询所有教师和同学的name、sex和birthday.
select s.sname,s.ssex,s.sbirthday from student s union select t.tname,t.tsex,t.tbirthday from teacher t;

32、查询所有“女”教师和“女”同学的name、sex和birthday.
select s.sname,s.ssex,s.sbirthday from student s where s.ssex='女' union select t.tname,t.tsex,t.tbirthday from teacher t where t.tsex='女';

select 练习4的更多相关文章
- 最全的ORACLE-SQL笔记
-- 首先,以超级管理员的身份登录oracle sqlplus sys/bjsxt as sysdba --然后,解除对scott用户的锁 alter user scott account unloc ...
- Matplotlib数据可视化(6):饼图与箱线图
In [1]: from matplotlib import pyplot as plt import numpy as np import matplotlib as mpl mpl.rcParam ...
- SELECT INTO 和 INSERT INTO SELECT 两种表复制语句
Insert是T-sql中常用语句,Insert INTO table(field1,field2,...) values(value1,value2,...)这种形式的在应用程序开发中必不可少.但我 ...
- select、poll、epoll之间的区别总结
select.poll.epoll之间的区别总结 05/05. 2014 select,poll,epoll都是IO多路复用的机制.I/O多路复用就通过一种机制,可以监视多个描述符,一旦某个描述符就绪 ...
- LINQ to SQL Select查询
1. 查询所有字段 using (NorthwindEntities context = new NorthwindEntities()) { var order = from n in contex ...
- ADO.NET一小记-select top 参数问题
异常处理汇总-后端系列 http://www.cnblogs.com/dunitian/p/4523006.html 最近使用ADO.NET的时候,发现select top @count xxxx 不 ...
- iosselect:一个js picker项目,在H5中实现IOS的select下拉框效果
具体文档和demo可以访问github:https://github.com/zhoushengmufc/iosselect 移动端浏览器对于select的展示样式是不一致的,ios下是类似原生的pi ...
- SQL Server中SELECT会真的阻塞SELECT吗?
在SQL Server中,我们知道一个SELECT语句执行过程中只会申请一些意向共享锁(IS) 与共享锁(S), 例如我使用SQL Profile跟踪会话86执行SELECT * FROM dbo.T ...
- (转载) Linux IO模式及 select、poll、epoll详解
注:本文是对众多博客的学习和总结,可能存在理解错误.请带着怀疑的眼光,同时如果有错误希望能指出. 同步IO和异步IO,阻塞IO和非阻塞IO分别是什么,到底有什么区别?不同的人在不同的上下文下给出的答案 ...
- 基于select的python聊天室程序
python网络编程具体参考<python select网络编程详细介绍>. 在python中,select函数是一个对底层操作系统的直接访问的接口.它用来监控sockets.files和 ...
随机推荐
- 让background-color 无效
{ background-color: transparent; // 让背景透明,相当于背景颜色无效 }
- POJ C Looooops
Description A Compiler Mystery: We are given a C-language style for loop of type for (variable = A; ...
- 在脚本中刷新impala元信息
刷新impala元信息 impala-shell -q 'invalidate metadata' -i hslave1 impala-shell -q 'select count(*) from p ...
- ios多线程开发的常用三种方式
1.NSThread 2.NSOperationQueue 3.GCD NSThread: 创建方式主要有两种: [NSThread detachNewThreadSelector:@selector ...
- Chap4: question: 19 - 28
19. 二叉树的镜像(递归) 即:交换所有节点的左右子树.从下往上 或 从上往下 都可以. #include <iostream> #include <string> usin ...
- shell 初学者 必读 ,强烈推荐新手读
背景: 很多人从C/C++转化而来,看了学习文档之后,踩入了很多坑 1 对变量赋值 不要有空格 a=123 # 正确 a = 123 # 错误 2 if语句 [] 要留有空格,变量最好加" ...
- Dynamics Webservice Call with Credential
Dynamics Webservice call with credential /// <summary> ///WebServiceHelper 的摘要说明 /// </summ ...
- android 程序开机自启动
今天遇到程序开机自启动,然后查了一下,很简单,就记录一下. 开机自启动,一般我们是开启启动一个广播,然后在广播里启动Activity或者别的服务. 我们要做的很简单,就是在AndroidManifes ...
- android Drawable的问题
1.资源解析成Drawable getDrawable(int id); 挺简单一方法,可是 require api 21......如何向下兼容呢???? 幸亏有ContextCompat类...( ...
- Entity Framwork(EF) 7——在现在数据库的甚而上开发MVC 新项目
一.开发背景: 由于老系统已经无法满足实际业务需求,需在现有数据库的甚而上开发新的项目. 二.困难点: 而EF默认情况下是要删除现有数据库表格后重新创建,这是不允许的.当你创建数据库对象时系统会提示“ ...