May 5, 2016

CREATE TABLE AS SELECT (CTAS)

    CREATE TABLE my_table AS SELECT * FROM my_other_table
  • The best thing about CTAS is that it does not use rollback segments .
  • The above query will copy all the data from the source table to destination table 
  • CTAS is a particularly powerful tool for populating or rebuilding a single partition of a partitioned table 
     CREATE TABLE my_table AS SELECT * FROM my_other_table
             where 1= 2
  •  The above query will not copy the data from the source table to destination table.It will only create the structure of source table. 
     

No comments: