Primary Key Help

  • Thread starter Thread starter Jack
  • Start date Start date
Joan Wild said:
field to this table.

Would you do so even for a table of States?

You would use
StateID - autonumber
StateCode - 2 char text
StateName - full name

The StateCode isn't likely to change.
 
I think that it is not a good idea to run around creating meaningless
pieces of data to keep track of data that already have unique identifiers,....

Hmmm.....even when creating that meaningless piece of data can:
1.) Save on database space (see earlier sample calculations)
2.) Reduce network traffic
3.) Prevent the need to ever have to update a PK value (since it is meaningless), which means a
lessened chance of database corruption versus updating a text-based PK, especially in a
multi-user DB.
4.) Speed the database operations--since computers work in a binary world, all key values must be
converted to binary. The conversion of a number in the base 10 system (ie. an autonumber) to base
2 is undoubtedly faster than converting a text-based PK to its equivalent binary representation
Also the statement that all tables should have primary keys is bunk.
It may be a rare case, but sometimes the Key just gets in the way
and serves no purpose.
It is a rare case. Very rare indeed. So rare, it's really NOT worth mentioning. About the
only table that I can think of in a relational database that fits this case is the Switchboard
Items table, created by the Switchboard Manager. I suppose a PK really doesn't serve a lot of
purpose in that case, since this table is not related to other tables in the database.
(Personally, I don't use the Switchboard Manager to build my switchboards; I use an unbound form,
usually with a tab control).

Tom
___________________________________________


I would like to put my two cents in. I think that it is not a good idea
to run around creating meaningless pieces of data to keep track of data
that already have unique identifiers, Such as states or zip codes,
Driver's Licence, etc.

When you create a top level table (say a Vehicle table for a car lot)
do you create a unique identifier to describe a vehicle or do you use
the VIN number (already unique). The created number really has no
meaning to anyone outside the car lot (and probably not in the car lot
either).

Also the statement that all tables should have primary keys is bunk.
It may be a rare case, but sometimes the Key just gets in the way and
serves no purpose. If you create a single table that has no unique
way of identifying itself then adding a Primary key just adds more data
to the db.
 
Back
Top