加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sqlserver

发布时间:2020-12-12 13:11:09 所属栏目:MsSql教程 来源:网络整理
导读: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 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分以上的学生信息

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读