Re: Advice on key design
От | Bèrto ëd Sèra |
---|---|
Тема | Re: Advice on key design |
Дата | |
Msg-id | CAKwGa_8T0H4Mp7=cO2VGiaPdpXJGo33CmUZSe_bVEVJ2Yf7dhA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Advice on key design (Luca Ferrari <fluca1978@infinito.it>) |
Ответы |
Re: Advice on key design
|
Список | pgsql-sql |
Hi,
Get me right, just trying to understand what you guys are doing.
Bèrto
On 24 July 2013 10:39, Luca Ferrari <fluca1978@infinito.it> wrote:
On Wed, Jul 24, 2013 at 10:38 AM, Bèrto ëd Sèra <berto.d.sera@gmail.com> wrote:The serial key, also named "surrogate key" is there for management
> What would be the rationale behind the serial number?
>
purposes. Imagine one day you find out your database design is wrong
and what was unique the day before is no more so, how can you find
your records?
The idea is to have a surrogate key to save you from real world
troubles, and then constraints to implement the database design.
I usually use this convention:
- primary surrogate keys named pk and defined as primary keys
- database design keys named _key and defined with a unique constraint.
Luca
==============================
If Pac-Man had affected us as kids, we'd all be running around in a darkened room munching pills and listening to repetitive music.
В списке pgsql-sql по дате отправления: