视图实现 连接查询和嵌套查询.docVIP

  • 37
  • 0
  • 约3.49千字
  • 约 12页
  • 2017-06-17 发布于湖北
  • 举报
------------------(连接查询)-------------------- 1)查询信息系且年龄在21 岁以下(含21 岁)的女生姓名及其年龄。 select sname,age from student,dept where student.deptno=dept.deptno and dept.dname=信息 and age=21 and sex=女 方法2: 用视图实现查询:注意表之间的连接条件、筛选条件的设置 查询结果 2)查询计算机科学与技术系教师的授课情况(显示系名、教师名、课程名)。 select dname,tname,cname from dept,course,teacher where course.tno=teacher.tno and teacher.deptno=dept.deptno 视图实现: 3)查询每个学生的选课情况(显示学号、姓名、系名、课程名、成绩)。 select student.sno,sname,dname,cname,grade from student,dept,course,sc where student.deptno=dept.deptno and sc.sno=student.sno and sc.cno=course.cno 视图实现: 4)查询各个系的学生人数(显示系名、学生人数)。 select d

文档评论(0)

1亿VIP精品文档

相关文档