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
Boosting eCommerce Growth with Enteros: AI SQL, RevOps Efficiency, and Performance Optimization for the Digital Marketplace
- 28 October 2025
- Database Performance Management
Introduction The eCommerce landscape is evolving at an unprecedented pace. With billions of daily transactions, global supply chain integrations, and an ever-expanding digital customer base, eCommerce enterprises are under increasing pressure to maintain lightning-fast performance, accurate analytics, and cost-efficient operations.In this hyper-competitive environment, Enteros emerges as a transformative solution — combining AI SQL intelligence, RevOps … Continue reading “Boosting eCommerce Growth with Enteros: AI SQL, RevOps Efficiency, and Performance Optimization for the Digital Marketplace”
From Risk to Resilience: How Enteros Generative AI and Cloud FinOps Are Redefining Database Optimization in Insurance
Introduction The insurance industry has always been rooted in data — assessing risk, predicting trends, and ensuring long-term financial stability. Yet, in today’s digital-first ecosystem, the amount and complexity of insurance data have skyrocketed. From real-time underwriting models to automated claims processing and customer personalization, insurers depend heavily on vast, dynamic, and distributed databases. Managing … Continue reading “From Risk to Resilience: How Enteros Generative AI and Cloud FinOps Are Redefining Database Optimization in Insurance”
Driving Financial RevOps Efficiency with Enteros: AIOps-Powered Database Performance for Smarter Decision-Making
- 27 October 2025
- Database Performance Management
Introduction In today’s competitive financial ecosystem, where every second and every data point matters, achieving operational agility and revenue precision has become a top priority. Financial institutions — from banks and insurance companies to fintech innovators — are seeking more intelligent ways to manage their data-driven operations. The convergence of Revenue Operations (RevOps), database performance … Continue reading “Driving Financial RevOps Efficiency with Enteros: AIOps-Powered Database Performance for Smarter Decision-Making”
Revolutionizing Healthcare Efficiency with Enteros: SaaS Database Optimization, Generative AI, and Cloud FinOps Synergy
Introduction The healthcare sector has entered a new digital era driven by innovation, patient data analytics, and intelligent automation. From hospital management systems and patient monitoring to clinical research and predictive diagnostics, the industry’s growing dependence on cloud-based data systems has introduced both immense opportunities and operational challenges. As healthcare organizations scale their operations, managing … Continue reading “Revolutionizing Healthcare Efficiency with Enteros: SaaS Database Optimization, Generative AI, and Cloud FinOps Synergy”