I was wondering if there is a command to clone a table in PostgreSQL. By cloning I mean with the same schema, so that it already identifies the primary key, foreign keys (if applicable), etc.
Thanks
I was wondering if there is a command to clone a table in PostgreSQL. By cloning I mean with the same schema, so that it already identifies the primary key, foreign keys (if applicable), etc.
Thanks
I believe the answer is here, in the deep cloning part of the article
CREATE TABLE new_table LIKE original_table;
INSERT INTO new_table SELECT * FROM original_table;
https://towardsdatascience.com/how-to-clone-tables-in-sql-dd29586ec89c