create table new_table as select * from old_table where 1=0;
创建一个表new_table和old_table表结构一样(有old_table的记录)
create table new_table as select * from old_table;
复制一个表到另一个表
insert into new_table select * from old_table;
创建视图,删除视图
create or replace view **_view as select * from **table;
drop view **_view;
创建临时表
create global temporary table tablename on commit preserve rows as select * from others_table
Oracle临时表的实际用法的经验心得
临时表只能在当前连接内有效;
临时表不建立索引,所以数据量比较大或进行多次查询时,不推荐使用;
数据处理比较复杂的时候表快,反之视图快点;
在仅仅查询数据的时候建议用游标;
我们目前所使用的 Oracle 是作为数据库支撑平台的实际应用,可以说其数据量还是算的上比较庞大的系统,即表的数据量一般情况下都是在百万级以上的数据量。
当然在 Oracle 中创建分区是一种不错的选择,但是当你发现你的应用有多张表关联的时候,并且这些表大部分都是比较庞大,而你关联的时候发现其中的某一张或者某几张表关联之后得到的结果集非常小并且查询得到这个结果集的速度非常快,那么这个时候我考