Question: how to copy data from one table to another in postgresql?
Answer: CREATE TABLE mycopy AS SELECT * FROM mytable; or. CREATE TABLE mycopy (LIKE mytable INCLUDING ALL); INSERT INTO mycopy SELECT * FROM mytable; If you need to select only some columns or reorder them, you can do this: INSERT INTO mycopy(colA, colB) SELECT col1, col2 FROM mytable;