CTAS

引用地址:http://blog.youkuaiyun.com/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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值