Create structure, duplicate & backup of the table in Postgress Database
Use of CTAS for creating the Duplicate table with data or only structure (by using where 1 = 0) in the following database as follows:
Postgress database: Syntax for CTAS:
-- Create replica of table for backup
CREATE TABLE employees_new AS SELECT * FROM employees;
-- Create only structure
CREATE TABLE employees_new AS SELECT * FROM employees where 1=0;