Re: Migrating Data Between PG Tables

From: banghe <banghe(at)baileylink(dot)net>
To: Mike Darretta <michael(dot)darretta(dot)ctr(at)metnet(dot)navy(dot)mil>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Migrating Data Between PG Tables
Date: 2004-10-05 20:21:55
Message-ID: 41630263.1080301@baileylink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

One sql statement can solve this:

sql> isnert into table_b (id, name, summary) select id, name, desc from
table_a;

Banghe

Mike Darretta wrote:

> Does anyone have a suggestion on the best way to migrate data between
> two slightly different tables? For example:
>
> Table A
> --------
> id : integer
> name : string
> desc : string
>
>
> Table B
> --------
> id : integer
> name : string
> date : date
> summary : string
>
> In this example, I would like to copy all the data from Table A into
> B, using the desc column to populate the summary column.
>
> Thanks,
> Mike
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Mike Darretta 2004-10-05 20:29:35 Re: Migrating Data Between PG Tables
Previous Message Mike Darretta 2004-10-05 20:13:54 Migrating Data Between PG Tables