Oracle视图
来源:互联网 发布:手机电量显示软件 编辑:程序博客网 时间:2024/05/18 01:06
视图并不真正存储数据,其数据来自引用的表,oracle只在数据字典中存储视图的定义信息。
创建视图:
create[or replace] view <view_name> [alias[,alias]...]--alias别名,若子查询包含函数和表达式必须定义
as <subquery> --subquery 子查询语句
[with check option] [constraint constraint_name] --with check option 指定在视图上的check约束
[with read only] --with read only 只读视图
建立只读视图:
create or replace view stu_view as
select * from stu where classid=4
with read only;
用户只能对该视图进行select操作,不能dml
建立复杂视图:
create or replace view emp_view as
select deptno 部门编号,max(sal) 最高工资 avg(平均工资) from emp group by deptno;
select * from emp_view order by 部门编号;
管理视图:
查看视图定义:
desc stu_view;
select text from user_views where view_name='STU_VIEW';
重新编译视图:
当引用表的定义改变后,视图标记为无效。当调用该视图时oracle重新编译。也可以手动编译
alter view stu_view compile;
删除视图:
drop view stu_view;
- oracle视图
- oracle视图
- Oracle视图
- Oracle视图
- Oracle视图
- Oracle视图
- oracle视图
- Oracle 视图
- oracle 视图
- oracle视图
- oracle视图
- oracle 视图
- oracle 视图
- Oracle视图
- Oracle视图
- oracle 视图
- oracle视图
- oracle 视图
- ubuntu中如何配置mysql
- 一个只有钱途的浮躁社会
- Java内存分配、管理小结
- Hough变换原理
- 内核替换
- Oracle视图
- 看了大婶的故事后
- 剖析RedHat Linux中三个重要内核文件
- hdu 1003 max sum
- 关闭/开启Red hat防火墙
- 计算机本科/硕士找offer的总结
- Javascript闭包
- nyoj37 回文字符串
- Java中JButton常用设置