Dawson, Michael wrote:

> I'm well aware of the need for a primary key, in addition to a sound
> table design, however, I'd like someone else to "word" a response for
> me.
> 
> A co-worker built a data file (a data table on an AS400) with six
> fields.  The only unique "key" of the record is the entire record,
> itself.  The combination of all six fields must be used to identify the
> exact record.

There's no justification for doing that. None!

> "This is how it's done," is the reply I get.  (I've been building
> web-based apps using relational DBs for 8 years.  I have never used an
> entire record as the primary key.)

Say it with my, kids: Most. Useless. Table. Indexing. Ever.

> I'm not passing an entire record through a URL or in hidden form fields.
> Imagine the nightmare of maintaining this application...

Moreover, what use is the table when you have to pass around whole
tuples to do lookups on it?

A few things spring to mind: your cow-orker has no clue what
normalisation is; they

> A discussion of the existence of Oracle's sequences and SQL's identity
> fields did little to sway this person's opinion.  This person's entire
> development background is AS400 with a history of bad database design.

The thing is, they should know this *anyway*! Take the example of a
users table, like this

CREATE TABLE users
(
     user_name       VARCHAR(16) NOT NULL PRIMARY KEY,
     user_password   VARCHAR(32) NOT NULL, -- Holds MD5 hash of password
     -- ...other fields...
);

user_name makes sense as a primary key: it's uniques for each tuple, and
it's never going to change.

What is this person doing designing table schemas anyway?

> Now, I'm creating the table myself to do it right.  ;-)

Do, and if they complain then do some benchmarking to show them that 
your schema is just better. Then tell them "that's how it's done".

-- 
Keith Gaughan, Developer
Digital Crew Ltd., Pembroke House, Pembroke Street, Cork, Ireland
http://digital-crew.com/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183719
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to