agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: John R Pierce <pierce@hogranch.com>
To: pgsql-general@postgresql.org
Subject: Re: [SQL] extracting PII data and transforming it across table.
Date: Wed, 27 May 2015 21:57:43 -0700
Message-ID: <5566A047.20803@hogranch.com> (raw)
In-Reply-To: <CAJP7dtAUthVNUYf-3-4_9wDXUHZW=T_zDJf4SMvforsTGkZ62w@mail.gmail.com>
References: <CAJP7dtBAG+9=41UAn6iUhX_RkFvgB86Toh_Uqzb3OvngZ0fbLA@mail.gmail.com>
	<CAJexoS+kzEmHn2LqzQ2U+KP-wMjjRKQ0EC+KWSaYnimK5ifQsA@mail.gmail.com>
	<CAJP7dtAUthVNUYf-3-4_9wDXUHZW=T_zDJf4SMvforsTGkZ62w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

On 5/21/2015 9:51 AM, Suresh Raja wrote:
>
>         I'm looking at directions or help in extracting data from
>         production and alter employee id information while
>         extracting.  But at the same time maintain referential
>         integrity across tables. Is it possible to dump data to flat
>         file and then run some script to change emp id data on all
>         files.  I'm looking for a easy solution.
>
>         Thanks,
>         -Suresh Raja
>
>
> Steve:
> I too would like to update the id's before dumping.  can i write a sql 
> to union all tables and at the same time create unique key valid 
> across tables.

it sounds like you have a weak grasp of delational database design

I would have a single Employee table, with employee ID as the primary 
key, and any other attributes which are common to all employees, then I 
would have other tables which contain information about specific 
employee types or groups, these other tables could have their own 
primary key, but would reference the Employee table EmployeeID field for 
the common employee attributes.



-- 
john r pierce, recycling bits in santa cruz

view thread (5+ messages)  latest in thread

Message-ID: <5566A047.20803@hogranch.com>
Permalink:  ../5566A047.20803@hogranch.com/
Also on:    postgresql.org/message-id/5566A047.20803@hogranch.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pierce@hogranch.com, pgsql-general@postgresql.org
  Subject: Re: [SQL] extracting PII data and transforming it across table.
  In-Reply-To: <5566A047.20803@hogranch.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox