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的索引