zoukankan      html  css  js  c++  java
  • 关于SQLite作业

    --查询Student表中的所有记录的Sname、Ssex和Class列。
    SELECT sname,ssex,class from Student

    --查询教师所有的单位即不重复的Depart列。
    SELECT DISTINCT depart from Teachear

    --查询Student表的所有记录。
    SELECT * from Student

    --查询Score表中成绩在60到80之间的所有记录。
    SELECT * from Score where Degree BETWEEN 60 and 80

    -查询Score表中成绩为85,86或88的记录。
    SELECT * from Score WHERE Degree IN('85','86','88')

     

    --查询Student表中“95031”班或性别为“女”的同学记录。
    SELECT * FROM Student WHERE Ssex='女'AND Class='95031''

    --以Class降序查询Student表的所有记录。
    SELECT * FROM Student ORDER BY class DESC

    --以Cno升序、Degree降序查询Score表的所有记录。
    SELECT *from Score ORDER BY degree DESC,cno asc

    --查询“95031”班的学生人数。
    SELECT count(*) from Student WHERE Class='95031'

    -查询Score表中的最高分的学生学号和课程号
    --SELECT a.Sno,b.Sname,a.Cno,a.Degree FROM Score a,Student b,Course c WHERE a.Sno = b.Sno and a.Cno=c.Cno and a.Cno='3-245'
    select * from score order by degree desc --答案

    --查询每门课的平均成绩。
    SELECT cno,avg(degree) from Score GROUP BY Cno

    --查询Score表中至少有5名学生选修的并以3开头的课程的平均分数。
    SELECT avg(degree) FROM Score WHERE cno in (SELECT cno from Score GROUP BY cno having count(*)>5) and cno LIKE '3%' GROUP BY Cno

    --查询分数大于70,小于90的Sno列。
    --SELECT * FROM Score WHERE Degree BETWEEN 70 and 90
    SELECT sno from Score WHERE Degree BETWEEN 70 and 90 --答案

  • 相关阅读:
    Pydev Console中文提示乱码的问题
    pg_dump命令帮助信息
    Aptana下Django1.6以后的项目模板结构改造
    老外的项目开发在线服务网站资源
    淘宝技术交流笔记
    Python并发编程的几篇文章
    gevent程序员指南
    IOS UITableView拖动排序功能
    Codeforces 300A Array
    一次mysql优化经历
  • 原文地址:https://www.cnblogs.com/TENOKAWA/p/5545839.html
Copyright © 2011-2022 走看看