select STUDENT.Sno,SUM(Degree) as '总成绩' from Student,SC
where Ssex = '女' and Student.Sno = SC.Sno
group by Student.Sno;
select Cno,Degree from SC,Student
where SC.Sno = Student.Sno and Student.Sname='李勇';
select Course.Cno,Cname from Course,Teaching,Teacher
where Teacher.Tname = '李新' and Teacher.Tno = Teaching.Tno and Teaching.Cno = Course.Cno;
select Course.Cno,Teacher
where Teacher.Tsex='女' and Teacher.Tno = Teaching.Tno and Teaching.Cno = Course.Cno;
select Course.Cname from Course,Student,SC
where Student.Sname like '王%' and SC.Cno = Course.Cno and SC.Sno = Student.Sno;
select SC.Sno,SC.Degree from SC,Course
where Course.Cname='数据库' and Course.Cno = SC.Cno and SC.Degree between '80' and '90';
select AVG(YEAR(getdate())-year(Student.Sbirthday)) from Student,SC
where Student.Sno=SC.Sno and SC.Cno='C02';
select SC.Sno,Student.Sname from SC,Course,Student
where Course.Cname='数学' and SC.Cno = Course.Cno and Student.Sno = SC.Sno;
select Teaching.Cno,SC.Sno,SC.Degree from Teaching,SC,Teacher
where Teacher.Tname='钱军' and Teaching.Tno = Teacher.Tno and Teaching.Cno = SC.Cno;
select Teaching.Cno,SC
1. where Teaching.Cterm=3 and Teaching.Cno = SC.Cno;
二、嵌套查询
1. 查询至少选修两门课程的男学生姓名
2. 查询与李勇同一个系的其他同学姓名
3. 查询学号比刘晨同学大,而年龄比他小的学生姓名
4. 查询年龄大于所有女同学的男同学的姓名及系别
5. 查询成绩比该课程平均成绩高的学生的学号、课程号及成绩
6. 查询不讲授“C01”课的教师姓名
7. 查询没有选修“C02”课程的学生学号及姓名
8. 查询选修了“数据库”课程的学生学号、姓名及系别
9. 查询选修了全部课程的学生姓名
10. 分别用子查询和连接查询,求“C02”号课程在80分以上的学生信息
总结以上是内存溢出为你收集整理的sqlserver全部内容,希望文章能够帮你解决sqlserver所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)