CREATE TABLE AS statement
PostgreSQL CREATE TABLE AS statement is used to create a table from an existing table by copying columns of a current table. It is important to note that building a table will fill the new table with records from the existing table (based on the SELECT operator).

The syntax for CREATE TABLE AS in PostgreSQL
CREATE TABLE new_table AS
SELECT expressions
FROM existing_tables
[WHERE conditions];
Parameters and arguments of the statement
- table_name – The name of the table you want to create.
- expressions – Columns from existing_tables that you want to create in new_table. Will move the definitions of the columns from these columns to the new_table you made.
- existing_tables – Existing tables from which you can copy the column definitions and related entries (as suggested by WHERE).
- WHERE conditions – Optional. Requirements that must meet to copy records to the new_table.
Note:
- will copy column definitions from existing_tables to the new_table.
- new_table will be filled with entries based on conditions in the WHERE proposal.
Take the example of PostgreSQLCREATE TABLE, which shows how to create a table by copying all columns from another table.
CREATE TABLE current_inventory AS
SELECT *
FROM products
WHERE quantity > 0;
In this example, we will create a new table named current_inventory, including all columns from the products table. If the products table has records, fill the new current_inventory table with descriptions returned by the SELECT operator. Meanwhile, all entries from the product table with a number greater than 0 will be inserted into the current_inventory table when it is created.
Next, consider CREATE TABLE AS, which shows how to create a table by copying selected columns from multiple tables.
For example:
CREATE TABLE current_inventory AS
SELECT products.product_id, products.product_name, categories.category_name
FROM products
INNER JOIN categories
ON products.category_id = categories.category_id
WHERE products.quantity > 0;
This example will create a new table named current_inventory based on the column definitions from the products and categories tables. Also, the new current_inventory table will only add entries that satisfy the SELECT operator conditions.
PostgreSQL: Creating Tables with Constraints | Course
About Enteros
IT organizations routinely spend days and weeks troubleshooting production database performance issues across multitudes of critical business systems. Fast and reliable resolution of database performance problems by Enteros enables businesses to generate and save millions of direct revenue, minimize waste of employees’ productivity, reduce the number of licenses, servers, and cloud resources and maximize the productivity of the application, database, and IT operations teams.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Tech Sector: Why AI-Driven Workloads Push Databases to Their Limits
- 29 August 2025
- Software Engineering
Introduction The technology sector is entering a new era as artificial intelligence (AI) and machine learning (ML) evolve from experimental pilots to mission-critical business systems. From real-time recommendation engines to fraud detection and natural language processing, modern AI thrives on fast, reliable, and scalable database performance. But with this evolution comes a major challenge. AI-driven … Continue reading “Tech Sector: Why AI-Driven Workloads Push Databases to Their Limits”
Monitoring vs. Observability: Why Financial and Healthcare CIOs Need More Than Dashboards
Introduction For years, enterprises have relied on monitoring tools to track uptime and performance. Dashboards, alerts, and SLAs have been the foundation of IT operations. But in the age of cloud, AI, and compliance-heavy industries like financial services and healthcare, monitoring alone is no longer enough. Executives now face a bigger challenge: hidden inefficiencies at … Continue reading “Monitoring vs. Observability: Why Financial and Healthcare CIOs Need More Than Dashboards”
How Enteros Transforms Financial Services Database Performance in the Age of Cloud and Regulation
- 28 August 2025
- Software Engineering
Introduction Financial institutions must manage vast, continuous streams of real‑time data — from millions of daily payments and algorithmic trades to fraud detection and compliance checks — while controlling costs. Even milliseconds of delay can affect revenue, risk models, and customer experience. CIOs and CTOs face rising cloud costs, tighter SOX, Basel III, PCI-DSS, and GDPR … Continue reading “How Enteros Transforms Financial Services Database Performance in the Age of Cloud and Regulation”
How Enteros Harnesses AI Agents and Cloud FinOps to Transform Database Performance in the Healthcare Sector
In the fast-evolving world of finance, where banking and insurance sectors rely on massive data streams for real-time decisions, efficient anomaly man…