SQL語句的一道題 三個基本表:學生表(Student)、課程表(
1. select * from SC2. select Sname,Sage from Student where Sdept = '計算機'3. select Sno,Cno,Grade from SC where Grade >= 70 and Grade <= 804. select Sname,Sage from Student where Sage between 18 and 20 and Ssex = '男'5. select top 1 Grade from SC where Cno = 'C01'6. select max(Sage),min(Sage) from Student7. select Sdept,sum(Sno) from Student group by Sdept8. select *,sum(*),max(Grade) from SC join studet on * = * join Course on * = * group by *,max(grade)9. select sum(Cno),avg(Grade) from SC join Course on * = * join Student on *= * order by *10. select *,*,sum(Grade) A from SC join Student on * = * group by *,* having A > 20011. select *,* from Student join Course on * = * join SC on * = * where * = 'C02'12. select *,*,* from sc join student on * = * join course on * = * where * >= 80 order by * desc13. select cno,cname from ( select *,*,sun(sno) from student join course on * = * join sc on * = * group by cno,cname having sun(sno) > 0 )14. ① select *,* from ( select *,*,* from student join sc on * = * join course on * = * where * = 'C01' ) ② select *,* from ( select *,*,*,* from sc join student on * = sc,sno where * = '信息' and * >= 80 )③ select top 1 * from ( select *,*,sum(*) from sc join student on * = * where * = '計算機' group by *,* order by )15. delete from sc where grade < 5016. update sc set grade += 5 from sc join course on * = * join student on * = * where * = ( select * from sc join course on * = * where * = 'c01' )17. update sc set grade += 10 from sc join student on * = * where * = ( select * from student join sc on * = * join course on * = * where * = '計算機' and * = '計算機文化基礎' )18. create view [A] as select *,*,*,*,*,* from sc join student on * = * join course on * = *19. create view [A] as select *,avg(*) from sc join student on * = * group by *20. create view [A] as select *,sum(*) from sc join student on * = * group by *21. create index A on student(sname)22. 不會。
用SQL語句實現:學生表、課程表、選課表三張表中的問題:
第一個select *, *rom student s, sc twhere * = * * = ( select * from couse c where * = '計算機原理');第二個:select *rom student s, couse c, sc twhere * = * and * = * and * = '周星馳';第三個:select *, *rom student swhere * in ( select * from sc t group by * having count(*) = 5);我已經在本地數據庫建表測試過了,如果有什么問題,可以再聯系我。