How to insert values into a table from a select query in PostgreSQL

In this article, we will see how to insert values into a table from a select query in PostgreSQL.

Syntax to Copy one table data to another in PostgreSQL:

insert into table_name select * from another_table where condition;

Example to Copy one table data to another in PostgreSQL:

insert into oil select * from t_oil;

How to insert values into a table from a select query in PostgreSQL