Re: PRIMARY KEYS
| От | Karsten Hilbert |
|---|---|
| Тема | Re: PRIMARY KEYS |
| Дата | |
| Msg-id | 20030520144115.D562@hermes.hilbert.loc обсуждение исходный текст |
| Ответ на | Re: PRIMARY KEYS (Richard Huxton <dev@archonet.com>) |
| Ответы |
Re: PRIMARY KEYS
Re: PRIMARY KEYS |
| Список | pgsql-general |
> A primary key is a unique way to identify one row in a table.
> to have several keys, but only one would be your primary key. For example,
> here in the UK, each adult has a different National Insurance number. If you
> were writing a payroll application, you might have an internal "payroll_id"
> column as well as a "ni_num" column. Both are unique but it might make more
> sense in the application to use "payroll_id" - this is a business decision.
And - if you agree with database theory - a bad one at that.
Supposedly primary keys should be void of any meaning bar
their primary key-ness. I got into the habit of starting
any but the most simple table like this:
create table (
id serial primary key,
...
Never had any trouble with that. Good or bad practice ? Gotta
decide for yourself.
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
В списке pgsql-general по дате отправления: