阅读 131

数据库第四章(数据库第四章知识点)

外连接

 select * from student natural join takes

实际上有三种外连接

  • 左外连接

  • 右外连接

  • 全外连接

 

视图

视图定义

 create view faculty as select ID, name, dept_name from instructor
 
 
 create view physics_fall_2009 as
 select course.couse_id, sec_id, building, room_number
 from course, section
 where course.course_id = section.course_id
 and course.dept_name = 'Physicas'
 and section.semeaster = 'Fall'
 and section.year = '2009';

SQL查询中使用视图

 select course_id 
 from physics_fall_2009
 where building = 'Watson';

 

物化视图

特定数据库系统允许存储视图关系,但是他们保证:如果用于定义视图的实际关系改变,视图也跟着修改,这样的视图被称为物化视图

 

单个关系上的约束

  • not null

  • unique

  • check

创建索引

 create index studentID_index on student(ID)

上述语句在student关系的属性ID上创建了一个名为studentID_index的索引

 

标签:index,数据库,视图,course,第四章,section,id,select
来源: https://www.cnblogs.com/YanAemons/p/15584152.html


文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐