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的更多相关文章

  1. 最全的ORACLE-SQL笔记

    -- 首先,以超级管理员的身份登录oracle sqlplus sys/bjsxt as sysdba --然后,解除对scott用户的锁 alter user scott account unloc ...

  2. Matplotlib数据可视化(6):饼图与箱线图

    In [1]: from matplotlib import pyplot as plt import numpy as np import matplotlib as mpl mpl.rcParam ...

  3. SELECT INTO 和 INSERT INTO SELECT 两种表复制语句

    Insert是T-sql中常用语句,Insert INTO table(field1,field2,...) values(value1,value2,...)这种形式的在应用程序开发中必不可少.但我 ...

  4. select、poll、epoll之间的区别总结

    select.poll.epoll之间的区别总结 05/05. 2014 select,poll,epoll都是IO多路复用的机制.I/O多路复用就通过一种机制,可以监视多个描述符,一旦某个描述符就绪 ...

  5. LINQ to SQL Select查询

    1. 查询所有字段 using (NorthwindEntities context = new NorthwindEntities()) { var order = from n in contex ...

  6. ADO.NET一小记-select top 参数问题

    异常处理汇总-后端系列 http://www.cnblogs.com/dunitian/p/4523006.html 最近使用ADO.NET的时候,发现select top @count xxxx 不 ...

  7. iosselect:一个js picker项目,在H5中实现IOS的select下拉框效果

    具体文档和demo可以访问github:https://github.com/zhoushengmufc/iosselect 移动端浏览器对于select的展示样式是不一致的,ios下是类似原生的pi ...

  8. SQL Server中SELECT会真的阻塞SELECT吗?

    在SQL Server中,我们知道一个SELECT语句执行过程中只会申请一些意向共享锁(IS) 与共享锁(S), 例如我使用SQL Profile跟踪会话86执行SELECT * FROM dbo.T ...

  9. (转载) Linux IO模式及 select、poll、epoll详解

    注:本文是对众多博客的学习和总结,可能存在理解错误.请带着怀疑的眼光,同时如果有错误希望能指出. 同步IO和异步IO,阻塞IO和非阻塞IO分别是什么,到底有什么区别?不同的人在不同的上下文下给出的答案 ...

  10. 基于select的python聊天室程序

    python网络编程具体参考<python select网络编程详细介绍>. 在python中,select函数是一个对底层操作系统的直接访问的接口.它用来监控sockets.files和 ...

随机推荐

  1. 立体匹配:关于用OpenCV彩色化middlebury网站给定的视差

    #include "XYZ.h" void readPFM(Mat_<float> &disp, float &scale, string path) ...

  2. HashTable,HashSet与Dictionary

    1.HashTable 哈希表(HashTable)表示键/值对的集合.在.NET Framework中,Hashtable是System.Collections命名空间提供的一个容器,用于处理和表现 ...

  3. ios delegate你必须知道的事情

    在我们的class中设计delegate的时候,我们通常会有几个注意事项. 假设我的class叫做MyClass,那我们可能会有定义一个MyClassDelegate这个protocol当作我的del ...

  4. VBA_Excel_教程:过程,函数

    Sub s1() Debug.Print "s1" '调用过程:无括号,加call提升可读性 s2 Call s2 End Sub Sub s2() Debug.Print &qu ...

  5. sql(转自http://www.imooc.com/article/2325)

    http://www.imooc.com/article/2325

  6. js实现一套代码来控制所有的运动,图片的淡入淡出,winth,height的变宽

    介绍了那么多运动,這次一套代码实现所有运动 1.html代码和css代码,只是定义一个div <style> div{ width:200px; height:200px; margin: ...

  7. Android RadioGroup设置默认选中项

    今天有人问.Android 里面 RadioGroup里面有两个RadioButton怎么设置默认值? 第一个RadioButton设置 android:checked="true" ...

  8. Android ImageView显示本地图片

    Android ImageView 显示本地图片 布局文件 <?xml version="1.0" encoding="utf-8"?> <R ...

  9. Hibernate day03笔记

      Hibernate的关联关系映射:(多对多) 多对多的配置: 步骤一创建实体和映射: Student: public class Student {     private Integer sid ...

  10. 8. js中json格式解析

    var doc = O_PARAMETER.FJSonStr;(doc为:{"items":[],"nextId":0}) //1.先转为json对象,主要有以 ...