oracle複雜查詢(學生成績相關)

設有一個關係數據庫,有三個基本表,表結構如下:
表一、student
學號stu_id 姓名name 年齡age 性別gender 系號depart_id
表二、sc
學號stu_id 課程號course_code  成績score
表三、course
課程號course_code  課程名course_name 學時數 course_hour
1、編寫sql語句,查詢系號爲990020的同學的學號,姓名,課程名,成績。
2、編寫sql語句,查詢比學號是014206202216的同學年齡大1歲的同學的學號,姓名,年齡。
3、檢索選修課程在10門及以上的學生的系號,學號,姓名,最低分,最高分,平均分和所選課程總數,其結果要求按照系號,平均分排序(降序)。
4、請用SQL語言檢索至少選修了“學號爲014206202217的學生選修的全部課程”的學生的學號和姓名。
 
【答案】
(1)
select a.stu_id,a.name,b.course_name,c.score from student a,course b,sc c where a.stu_id=c.stu_id and c.course_code=b.course_code and a.depart_id=990020;
 
(2)
select stu_id,name,age from student where age>=1+(select age from student where stu_id=014206202216);
 
(3)
 

(4)

【注】本文所用到的完整sql語句代碼請下載本文的附件!

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