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 --答案

  • 相关阅读:
    c#: List.Sort()实现稳固排序(stable sort)
    c# dt.AsEnumerable ().Join用法
    C#中new的两种用法"public new"和"new public"
    简说设计模式——观察者模式
    mysql中explain的type的解释
    mysql 查询优化 ~explain解读之select_type的解读
    代理
    charle
    like语句防止SQL注入
    java学习网站
  • 原文地址:https://www.cnblogs.com/TENOKAWA/p/5545839.html
Copyright © 2011-2022 走看看