数据库的基础知识08
1、笛卡尔积--表与表的运算
例:
select *
from student,class
2、外键: 如果一个属性它不是它所在表的主键,但是它是另一个表的主键,它就称为它在表的外键。
where 连接条件 and 定语条件
3、例:
1.查询班号、班名及其所在系号、系名
select classno,classname,class.departno,departname
from class,department
where department.departno=class.departno
4、例:
2.查询学生的姓名及其所选的课程的名称
select stuname,couname
from student,course,stucou
where student.stuno=stucou.stuno and
course.couno=stucou.couno
5、例:
3.查询选修了旅游系开设的课程的学生的姓名, 课程名称、授课教师
select stuname,couname,teacher
from student,course,stucou,department
where student.stuno=stucou.stuno and
course.couno=stucou.couno and
department.departno=course.departno
and departname='旅游系'
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:85
阅读量:37
阅读量:38
阅读量:53
阅读量:20