Tuesday, January 8, 2019

Copy Table With or Without Data Using Create Table As statement

1. How to copy both the structure and data of a table
      create table emp_copy
      as
      select * from emp;

2. How to copy specific columns of a table along with their data.
     create table emp_copy
     as
     select empno, sal from emp;

3. How to copy only the structure of the table without the data.
    create table emp_copy
    as
    select * from emp
     where 1=0;

No comments:

Post a Comment