zoukankan      html  css  js  c++  java
  • 数据库SQL语句练习题10--18

    10.查询Score表中的最高分的学生学号和课程号。(子查询或者排序)

    select t.sno,t.cno from SCORE t where degree = (select max(degree) from SCORE t)

    11、 查询每门课的平均成绩。

    12、查询Score表中至少有5名学生选修的并以3开头的课程的平均分数。

    select avg(degree) from SCORE t where( cno in (select cno from SCORE t group by cno having count(1)>= 5 )) and cno like '3%';

    13、查询分数大于70,小于90的Sno列。

    14、查询所有学生的Sname、Cno和Degree列。

    15、查询所有学生的Sno、Cname和Degree列。

    select t.Sno,c.Cname,t.degree from score t join course c on c.Cno = t.Cno; 

    16、查询所有学生的Sname、Cname和Degree列。

    select t.sname,c.cname,s.degree from STUDENT t,course c,score s where t.sno = s.sno and s.cno = c.cno

    17、?查询“95033”班学生的平均分。

    select avg(degree) from SCORE t  where sno in (select t.sno from STUDENT t where class = '95033')

    18、 假设使用如下命令建立了一个grade表:
    create table grade(low number(3),upp number (3),rank char(1))
    insert into grade 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’)
    现查询所有同学的Sno、Cno和rank列。

  • 相关阅读:
    JAVA使用Marvin在图片中搜索图片
    Apache 4.x HttpClient
    关于Java 项目的思考总结
    追查Could not get a databaseId from dataSource
    web项目中从不同的路径读取文件
    JDBC通用方法实现
    CentOS6.4下Mysql数据库的安装与配置
    使用 Spring 容器管理 Filter
    CentOS安装JAVA
    为github帐号添加SSH keys
  • 原文地址:https://www.cnblogs.com/wenwen123/p/5584975.html
Copyright © 2011-2022 走看看