Re: Darn pop singers!
От | Ian Pilcher |
---|---|
Тема | Re: Darn pop singers! |
Дата | |
Msg-id | 40A239DB.8030005@comcast.net обсуждение исходный текст |
Ответ на | Re: Darn pop singers! (Oliver Fromme <olli@lurza.secnetix.de>) |
Список | 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.pilcher@comcast.net ========================================================================
В списке pgsql-novice по дате отправления: