|
Posted by Toby Inkster on 05/14/06 15:40
Dikkie Dik wrote:
> Say what? The primary key uniquely identifies the record. Without it,
> you don't even know which record to update. As shown above, you should
> identify a record by its key, NOT by its data. That is why keys should
> never relate to data.
This is complete rubbish from someone who's clearly learned their database
design principles from _The Muppets' Big Book of RDBMS Programming_.
Yes, when identifying a particular row in a database table, you should use
*a* key. (Not necessarily the primary key though, as in many cases a table
will have alternative candidate keys that may be used. All things being
equal though, might as well use the primary key if we have the choice.)
*But*, the primary key will often relate to data. In the general case
there is no need to introduce an arbitrary additional "pkey int" column to
the table. (Though in certain specific situations it might be necessary,
or simply more convenient.)
http://en.wikipedia.org/wiki/Natural_key
versus
http://en.wikipedia.org/wiki/Surrogate_key
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|