日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

SQL簡單查詢

 杜橋伊人 2020-05-05

1、查詢教師所有的單位即不重復的Depart列

select distinct depart from teacher

2、查詢Score表中成績在60到80之間的所有記錄

select * from score where degree between 60 and 80

3、查詢Score表中成績?yōu)?5,86或88的記錄

select * from score where degree in (85,86,88)

4、查詢Student表中“95031”班或性別為“女”的同學記錄

select * from student where class='95031' or ssex ='女'

5、以Cno升序、Degree降序查詢Score表的所有記錄

select * from score order by cno,degree desc

6、查詢“95031”班的學生人數(shù)

select count(*) from student where class='95031'

或者:select count(*) as scount from student where class='95031'  

---查詢結果另取列名 為scount 展示

7、查詢Score表中的最高分的學生學號和課程號

select sno,cno from score where degree=(select max(degree) from score) 

8、查詢每門課的平均成績

select cno,avg(degree) from score group by cno

9、查詢Score表中至少有5名學生選修的并以3開頭的課程的平均分數(shù)

select cno,avg(degree) from score group by cno having count(*)>=5 and cno like'3%'

10、查詢所有學生的Sname、Cno和Degree列

select sname,cno,degree from student,score

where student.sno=score.sno

或者:select sname,cno,degree from score join student on score.sno = student.sno

11、查詢所有學生的Sname、Cname和Degree列

select sname,cname,degree from student,course,score where student.sno = score.sno and score.cno=course.cno

或者:select sname,cname,degree from score join student on student.sno=score.sno join course on score.cno = course.cno

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多