SQL笔试题:下面是学生表(student)的结构说明
SQL笔试题:下面是学生表(student)的结构说明SQL笔试题:下面是学生表(student)的结构说明
下面是教师表(Teacher )的结构说明
下面是课程表(Course)的结构说明
下面是成绩表(SC)的结构说明
1、查询“001”课程比“002”课程成绩高的所有学生的学号; select a.s_id from (select s_id,score from SC where C_ID='001') a,(select s_id,score from SC where C_ID='002') b 2、查询平均成绩大于60分的同学的学号和平均成绩; select S_ID,avg(score) 3、查询所有同学的学号、姓名、选课数、总成绩; select Student.S_ID,Student.Sname,count(SC.C_ID),sum(score) 4、查询姓“李”的老师的个数; select count(distinct(Tname)) 5、查询没学过“叶平”老师课的同学的学号、姓名; select Student.S_ID,Student.Sname 6、查询学过“001”并且也学过编号“002”课程的同学的学号、姓名; elect Student.S_ID,Student.Sname from Student,SC where Student.S_ID=SC.S_ID and SC.C_ID='001'and exists( Select * from SC as SC_2 where SC_2.S_ID=SC.S_ID and SC_2.C_ID='002'); 7、查询学过“叶平”老师所教的所有课的同学的学号、姓名; select S_ID,Sname 8、查询课程编号“002”的成绩比课程编号“001”课程低的所有同学的学号、姓名; Select S_ID,Sname from (select Student.S_ID,Student.Sname,score ,(select score from SC SC_2 where SC_2.S_ID=Student.S_ID and SC_2.C_ID='002') score2 9、查询所有课程成绩小于60分的同学的学号、姓名; select S_ID,Sname 10、查询没有学全所有课的同学的学号、姓名; select Student.S_ID,Student.Sname 11、查询至少有一门课与学号为“1001”的同学所学相同的同学的学号和姓名; select distinct S_ID,Sname from Student,SC where Student.S_ID=SC.S_ID and SC.C_ID in (select C_ID from SC where S_ID='1001'); 12、查询至少学过学号为“001”同学所有一门课的其他同学学号和姓名; select distinct SC.S_ID,Sname |