筆記

1查詢年齡在19至21歲之間的女生的學號,姓名,年齡,按年齡從大到小排列。

2查詢姓名中第2個字爲“明”字的學生學號、性別。

use student

GO

select sno, sname, sage,ssex    from  student  

where ssex='女' and sage between 19 and 21


use student

GO

select sno,sname,ssex from student 

where sname like'_明%'



3查詢 1001課程沒有成績的學生學號、課程號 

select sno, cno   

from  sc    

where grade is null and cno='1001'


4查詢專業爲JSJ SX 計算機並且年齡大於25歲的學號和姓名


select Sno,Sname from student

where Sdept in('JSJ' ,'SX' ,'計算機')and Sage>25


select Sno,Sname from student

where (Sdept='JSJ' OR Sdept='SX' OR Sdept='計算機')and Sage>25


5查詢學號課程號,成績以十倍顯示並以A命名

select sno,cno,grade*10 as A from SC 


6查詢學生表中的系名

select distinct Sdept from student


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章