视图

视图

create or replace view 视图名称

as 

子查询;

(1)简单的单表视图,对其进行增删查改时,物理表也会做相应的操作

(2)复制视图,无法对其进行更新操作

(3)with check option constraint 约束名称:设置创建视图的字段不能修改

create or replace view v_mytest

as

select * from aaa where a=20

with check option constraint v_mytest_ck; 

(4)with read only 子句:设置视图只读

create or repalce view V_mytest 

as

select * from aaa where a=20

with read only;

(5)删除视图

drop view 视图名称;

原文地址:https://www.cnblogs.com/zuoyoufengyuan/p/8512562.html