视图: 从一张表或多张表中抽出的逻辑上相关的数据集合!!!(逻辑数据集:没有真正的数据)
1--- 创建简单视图:
用sys用户给scott用户授权,创建视图的权限(系统权限)
conn sys/***** as sysdba
grant create view to scott;
conn scott/*****
create or replace view view_30 as select * from emp where deptno=30;
(or replace :加入视图已经存在,可以覆盖)
回收该权限: revoke create view from scott;
2---查询视图
原理: oracle 访问user_views 数据字典,找到视图的子查询并执行,返回数据。
访问视图,实际是访问基表
select view_name,text from user_views;
3---视图的数据更新
使用create 或者 re