同义词+序列+视图+临时表
临时表:
1》 创建临时表(事务级别):commit 之后会被清空
Create global temporary table tabel_name(
Id number(10),
Name varchar(10),
Password varchar(10)
)on commit delete rows;
2》 创建临时表(会话级别):断开连接会清空
Create global temporary table table_name(
Id number(10),
Name varchar(10),
Password varchar(10)
)on commit preserve rows;
视图:
1》 创建视图:
Create view view_name
As select id,name,age from student;
Create view view_name
As select table_1_name.id,table_2_name.age where table_1_name.class=table_1_name.class;
2》 更新视图:
1) 查看可更新的列
Select column_name,updataable,insertable,deletable
From user_updatable_columns where table_name=‘view_name’;
2)更新视图
Updata view_name set column_name=’new_vlaue’ where column_name=’column_value’;
2) 视图更新后原来的表也更新
3》 删除视图:
Drop view view_name;
序列
1》创建序列:
Create sequence sequence_name
Start with n //开始位置
Increase by n //增长量
Nomaxvalue //最大值
Nocycle //复位循环
Cache n; //预分配
2》修改序列:
Alter sequence sequence_name increase by 5;
4》 删除序列
Drop sequence sequence_name;
同义词
1》 穿件同义词:
公有:Create public synonym stu for table_name;
私有:create synonym stu for table_name;
2》 删除同义词:
Drop public synonym synonym_name;
Drop synonym synonym_name