If you need to copy data from one table (table_a) into another table (table_b) using pgsql.
There are 2 methods on how to do this.
NOTE: If you are using this method table_b should not yet exist.
If you want an exact duplicate without indexing or relying on objects use this.
SELECT * INTO table_b FROM table_a
NOTE: This method will work if table_b already exist.
This method uses a subselect inside the INSERT statement
INSERT INTO table_b
Image Credits: Photo by Isis França on Unsplash.