全球旧事资料 分类
精品文档
Stude
tSS
ameSageSsex学生表
CourseCC
ameT课程表SCSCscore成绩表TeacherTT
ame教师表

1、查询“001”课程比“002”课程成绩高的所有学生的学号;selects1sfromSCs1SCs2wheres1ss2sa
ds1c001a
ds2c002a
ds1scores2score
2、查询平均成绩大于60分的同学的学号和平均成绩;selectssavgsscorefromSCsgroupbysshavi
gavgsscore60
3、查询所有同学的学号、姓名、选课数、总成绩;selectdsmaxds
amecou
tdisti
ctscsumsscorefromStude
tdSCswheredsssgroupbyds
4、查询姓“李”的老师的个数;selectcou
t0fromTeachertwherett
amelike李
5、查询没学过“叶平”老师课的同学的学号、姓名;selectdsds
amefromStude
tdwhere
otexists
selectdisti
ctssfromSCsTeachertCoursecwherettcta
dsccca
dtt
ame叶平a
ddsss
6、查询学过“001”并且也学过编号“002”课程的同学的学号、姓名;selectdsds
amefromStude
tdSCswheressdsa
dsc001a
dexistsselects1sfromSCs1wheres1sssa
ds1c002
7、查询学过“叶平”老师所教的所有课的同学的学号、姓名;selectssmaxds
amefromSCsStude
tdCoursecTeachertwheressdsa
dsccca
dcttta
dtt
ame叶平groupbysshavi
gcou
tdisti
ctsc
selectcou
t0fromCoursecTeachertwherecttta
dtt
ame叶平
8、查询课程编号“002”的成绩比课程编号“001”课程低的所有同学的学号、姓名;selectdsds
amefromSCs1SCs2Stude
tdwheres1ss2sa
ds1sdsa
ds1c002a
ds2c001a
ds1scores2score
9、查询所有课程成绩小于60分的同学的学号、姓名;selectssmaxds
amefromStude
tdSCswheredsssa
dsscore60groupbysshavi
gcou
t0selectcou
t0fromSCs1wheresss1s
10、查询没有学全所有课的同学的学号、姓名;selectssmaxds
amefromStude
tdSCswheredsssgroupbyss
1欢迎。下载
f精品文档
havi
gcou
tdisti
ctscselectcou
t0fromCourse
11、查询至少有一门课与学号为“1001”的同学所学相同的同学的学号和姓名;selectdisti
ctssds
amefromStude
tdSCswheredsssa
dss1001a
dexists
selects1cfromSCs1wheres1s1001a
dscs1c
12、查询至少学过学号为“1010”同学所有一门课的其他同学学号和姓名;selectdisti
ctssds
amefromStude
tdSCswheredsssa
dss1010a
dsci
selects1cfromSCs1wheres1s1010
13、把“SC”表中“叶平”老师教的课的成绩都更改为此课程的平均成绩;updateSCssetsscore
selectavgs1scorefromSCs1wherescs1cwhereexistsseler
好听全球资料 返回顶部