SQL: copy a table into another...
Solved
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.
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
-
Even cleaner:
CREATE TABLE table2 LIKE table1
(Simply copies the structure of table1 by creating table2)-
-
-
-
@mtk30Je ne peux pas fournir d'informations ou de contenu sur Postgres 9.3.
-
-