SQL question:

I am firm believer that all tables’ starts with one column, I my case I 
always call the column UID. The UID is a Unique Identifier.  This way I 
can reference any other column in another table to this unique record. 
I here assume everyone knows what I am talking about.

The question I have is should the UID be unique to only that table or 
should it be unique to the database?

If unique to the table, then configuring the table to have the first 
column to be an AUTO INCERMENT field and most issue are solved here.

If unique to the database then I assume you need to create a table for 
UID’s with only one column which would be an AUTO INCREMENT field and 
maybe a Session number field to know which new UID belongs to whom. 
When the requester has gotten the UID the requester can delete the 
record.  In this case the program has to do a little work in regards to 
get the UID from this table before you can insert a new record into any 
tables.

OK now lets make it a little more interesting since real life 
application many time have one-to-many or many-to-one relationships one 
could have a cross reference table that would either have two columns 
(UID | UID) if we have database unique UIDs or we could have four 
columns (UID | TableName | UID | TableName) if we have UID that is only 
unique to a table.

Any input on this topic?



 Bjarne \v/
Coordinate your email-newsletters with NTS eBlast tool suite
http://www.go2nts.com/eblast

________________________________________________________________________
AOL now offers free email to everyone.  Find out more about what's free 
from AOL at AOL.com.
=0
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to