学生选课数据库中表结构如下:
学生(学号,姓名,年龄,性别,所在系);
课程(课程号,课程名,学分,先行课);
选课(学号,课程号,成绩);
在学生选课数据库中运用SQL语言实现下面的数据查询操作。
- 求选修了高等数学的学生学号和姓名。
- 求张三学生选修成绩在90~95之间的课程名。
- 求其他系中比管理系某学生年龄小的学生信息。
- 求没有选修C2课程的学生姓名。
- 查询每个系的学生人数。
- 查询选修课程超过3门的学生学号和选课门数,要求只统计成绩及格的情况。
- 查询学生的选修情况,即学号、选课门数,并进行选修情况统计。
- 将计算机系学生的选课成绩提高10分。
- 删除成绩不及格的选课信息。
10)将学生表的查询、修改权限赋予用户user1.
1.select sno.sname from student
where sno in(select cno from course where cname =’高等数学’)
2.select cname from course
where cno in(select cno from sc
where grade between 90 and 95 and sno in (select sno from student
where sname =’张三’))
3.select * from student
where sdept != ‘管理系’ and sage < any (select sage from student
where sdept=’管理系’ )
4.select sname from student
where not exists(select * from sc where sno = student.sno and cno = ’c2’)
5.select sdept , count(sdept) from student group by sdept
6.select sno , count(cno) from sc
where grade >= 60 group by sno having count(cno) > 3
7.select sno , count(cno) from sc group by sno with cube
8.update sc set grade = grade + 10
where sno in(select sno from student where sdept = ‘计算机系’)
9.delete from sc where grade < 60
10..grant update_ select on table student to