copy table postgres code example
Example 1: postgres copy table from one schema to another
create table schema2.the_table (like schema1.the_table including all);
insert into schema2.the_table
select *
from schema1.the_table;
Example 2: copy table postgres
CREATE TABLE new_table AS
TABLE existing_table;
Example 3: copy table postgres
CREATE TABLE new_table AS
SELECT
*
FROM
existing_table
WHERE
condition;