[GLLUG] Is there any sane reason to do this? (Database question.)

John Winters john at sinodun.org.uk
Tue Oct 7 19:34:35 UTC 2014

On 07/10/14 20:27, Bernard Peek wrote:>
> It's called a surrogate key and in the database world it causes lots of
> arguments. Some people always use a surrogate key even when they have
> (as apparently here) a perfectly good natural key. If you want the full
> rant Google for my name in the comp.databases.theory newsgroup. I've
> lost count of how many times I've been through the argument.

I'm not sure this is quite a case of a surrogate key.  This isn't a case
of a table which could have been indexed uniquely by date, but instead
has had an extra id added to each record.  What I've quoted is *all* the
fields.  If you took away the DateIdent field you'd be left with just
the date, and you'd have to search the table by date to find the date.

This table seems to exist solely so that all the other tables which
should contain a date field, instead contain an integer field, and every
time you retrieve data from one of them you have to do a join to get the
full information.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20141007/7550a817/attachment.pgp>

More information about the GLLUG mailing list