How to Duplicate a Table in PostgreSQL

Last updated July 24, 2026 · By the SaturnSQL team

CREATE TABLE new (LIKE old INCLUDING ALL) copies structure, indexes, and defaults; INSERT ... SELECT copies the rows. CREATE TABLE AS SELECT is shorter but loses indexes and constraints.

Structure + data with indexes

CREATE TABLE orders_backup (LIKE orders INCLUDING ALL);
INSERT INTO orders_backup SELECT * FROM orders;

Quick copy, data only

CREATE TABLE orders_copy AS SELECT * FROM orders;

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related PostgreSQL guides

© 2026 Panda Capital Oy Ab. All rights reserved.