zoukankan      html  css  js  c++  java
  • CREATE TABLE 表名 AS SELECT 语句

     
    SQL
    > select * from dept; DEPTNO DNAME LOC ------ -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> create table dept2 as select * from dept; Table created SQL> select * from dept; DEPTNO DNAME LOC ------ -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> select * from dept2; DEPTNO DNAME LOC ------ -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> create table dept3 as select * from dept where 1 = 2; Table created SQL> select * from dept3; DEPTNO DNAME LOC ------ -------------- ------------- SQL> select OWNER from user_constraints where table_name = 'DEPT'; OWNER -------------------------------------------------------------------------------- SCOTT SQL> select OWNER from user_constraints where table_name = 'DEPT2'; OWNER --------------------------------------------------------------------------------

    Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
    Connected as scott

    由上面的使用 CREATE TABLE 表名 AS SELECT 语句可以看出:

        1:只会复制表数据和表结构,不会有任何约束。

        2:当 where 条件不成立时,只复制表结构,没有任务数据。

    转自:http://ears.iteye.com/blog/1470605

  • 相关阅读:
    Netty源码分析--Channel注册(上)(五)
    Netty源码分析--初始化Options,添加处理器(四)
    Netty源码分析--创建Channel(三)
    【2015 Week Task】
    【Mood 20】DailyBuild 4月
    【Gradle】 Gradle 综合
    【JS 综合】JS综合
    【IOS】IOS综合
    【起航计划 001】2015 起航计划 踏在起跑线上
    【HTML5】HTML5 综合
  • 原文地址:https://www.cnblogs.com/fwst/p/5213290.html
Copyright © 2011-2022 走看看