Skip site navigation (1) Skip section navigation (2)

Re: Darn pop singers!

From: Ian Pilcher <i(dot)pilcher(at)comcast(dot)net>
To: Oliver Fromme <olli(at)lurza(dot)secnetix(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Darn pop singers!
Date: 2004-05-12 14:51:07
Message-ID: 40A239DB.8030005@comcast.net (view raw or flat)
Thread:
Lists: pgsql-novice
Oliver Fromme wrote:
> 
> Create two tables, one for the real names, and one for the
> alias names.  The real_persons table would look like this:
> 
>   real_id | last_name  | first_name
>  ---------+------------+------------
>         4 | Jones      | David
> 
> And the aliases table would look like this:
> 
>   alias_id | real_id | last_name  | first_name
>  ----------+---------+------------+------------
>          5 |       4 | Bowie      | David
> 
> Of course, aliases.real_id should be made a foreign key to
> real_persons.real_id, so you cannot enter an alias for a
> real person which doesn't exist.  Note that alias_id and
> real_id are completely separate -- if you want to make them
> disjunct (for safety, so you can't mix them up), modify the
> sequences so that one produces only odd numbers and the
> other one only even numbers.  Or make one start at 10000000
> or whatever.
> 
> You can conveniently create a view in order to merge real
> persons and aliases together.
> 

Thank you!  I hadn't thought of using a view, but it does seem like the
right solution here.

-- 
========================================================================
Ian Pilcher                                        i(dot)pilcher(at)comcast(dot)net
========================================================================


In response to

pgsql-novice by date

Next:From: M. BastinDate: 2004-05-12 15:30:28
Subject: Re: ORDER BY and Unicode
Previous:From: Stephan SzaboDate: 2004-05-12 13:51:08
Subject: Re: ORDER BY and Unicode

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group