SQL: copy a table into another...

Solved
Nico -  
 necroma -
Hello everyone,

The query:
CREATE TABLE TABLE2 AS SELECT * FROM TABLE1 ;
allows me to copy the structure as well as the data from TABLE1 into TABLE2.
Is there a way (query) to copy only the structure (without the data)?

Thank you all for your help.

9 answers

  1. Lio
     
    Even cleaner:

    CREATE TABLE table2 LIKE table1

    (Simply copies the structure of table1 by creating table2)
    40
    1. Martin
       
      Even less on Oracle
      0
    2. mtk30
       
      encore moi sur PGsql 9.3
      0