Re: Insert values from one existing table into a new table.

From: "Wilco Boschman" <w(dot)boschman(at)xs4all(dot)nl>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Insert values from one existing table into a new table.
Date: 2001-11-13 21:33:03
Message-ID: 3bf1920f$0$201$e4fe514c@newszilla.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-sql

Assuming that the structure of the tables are identical, you could do a:

insert into new_table
select * from some_table;

If they are not the same you could do a:

insert into new_table (column1, column2)
select column1, column2 from some_table;

Cheers,

Wilco Boschman

"Jason" <jzhu(at)dental(dot)temple(dot)edu> schreef in bericht
news:9srij6$gre$1(at)cronkite(dot)temple(dot)edu(dot)(dot)(dot)
| I want to insert the existing values of one table into a new table. It
| needs the combination of these to sql commands:
|
| " insert into new_table values ( values_of_AtrributeA,
| values_of_AttributesB) "
| " select AttributeA, AttributeB from some_table "
|
| Thanks for your suggestions! -- Jason
|
|
|

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-11-13 21:33:27 Re: Full text search
Previous Message Tom Lane 2001-11-13 21:04:44 Re: how do I update or insert efficently in postgres