Re: Copy Data Question

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: operationsengineer1(at)yahoo(dot)com, pgsql-novice(at)postgresql(dot)org
Subject: Re: Copy Data Question
Date: 2006-06-22 21:16:51
Message-ID: 20060622211651.48398.qmail@web31815.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> how can i add *only* nonexisting entries to my db
> tables (iow, if it is one of the 100+ there now, i
> don't want to mess with it)?

I will take a stab at the easy question. Out of test solutions, this is the one that I know.

1. create a temp table using destination table schema using the LIKE clause.
http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html

2. import external data into the temp table.

3. select into destinationtable from temptable where temptable.primarykey not exists
( select destinationtable.primarykey
from destination table
);

> also, how do i update multiple tables with related
> info? do i create a view and then copy to the view?
>
> will that automatically update the tables?

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message operationsengineer1 2006-06-22 21:54:47 Re: Copy Data Question
Previous Message operationsengineer1 2006-06-22 20:31:43 Copy Data Question