CTAS

引用地址:http://blog.csdn.net/changyanmanman/article/details/7899045

哈哈别被名字唬住了,很简单,只不过之前没有接触这几个缩写。

CTAS  (From Oracle FAQ

CTAS refers to a CREATE TABLE AS statement - a new table is created and populated with row from a specified query. 

By default, only NOT NULL constraints will be copied to the target table (unless specified - see example below).

History

From Oracle 7 CTAS statements can be performed in parallel (Oracle Enterprise Edition only).

Examples

Simple CTAS statement:

SQL> CREATE TABLE emp2 AS SELECT * FROM emp;
Table created.
 
   

Specifying a tablespace(指定表空间):

SQL> CREATE TABLE emp3 TABLESPACE users AS SELECT * FROM emp;
Table created.
 
   

Parallel CTAS with nologging for faster performance:

SQL> CREATE TABLE emp4 NOLOGGING PARALLEL 4 AS SELECT * FROM emp;
Table created.
 
   

Normal CTAS, but also define a primary key on the target table:

SQL> CREATE TABLE emp5 (empid PRIMARY KEY) AS SELECT empid FROM emp;

你可能感兴趣的:(CTAS)