View Single Post
  #9  
Old June 8th, 2009, 04:00 PM posted to microsoft.public.access.tablesdbdesign
Bernard Peek[_3_]
external usenet poster
 
Posts: 42
Default New Database - Primary Key

In message , Trini
Gal writes
Bernard and Armen,

Thank you for answering. Honestly, I have read so much about why I should
and shouldn't be using the AutoNumber, that I just didn't use it and used the
DMax function instead. I don't know anything about the SQL Server, I only
know a little Access. I don't know what you mean by "natural key".


A natural key is a unique identifier that is derived from the data
itself rather than being added later. If there is a field or combination
of fields that uniquely identifies a record then that is a natural key.
If you don't have a natural key in each of your tables then you may have
to do some more analysis.

Access is a very nice tool for some jobs but it has limitations. It's
not suitable for applications where lots of people need frequent access
to the data. For those types of applications SQL Server is more
appropriate.



This is what I have right now:

Channel_ID (incrementing #, say 9 is the next #)
Division (NC, SC)
Region (Manhattan, Bronx, Brookly, Queens)

So when the user selects the Division and Region, the File_Name eg
SC_Bronx_9, which is a concatenation of all three fields, which I have as the
Primary Key.

Was that a good decision? Thats where I need your input. I read some
threads where there are like 2 and 3 primary keys, but I didn't quite
understand that.


There must be only one primary key in any table but it can be made up
from more than one column. The primary key has to be unique but that
doesn't mean that the individual components have to be unique. It just
means that any possible combination of the values in the component
fields must not occur more than once and none of the components can ever
be null.

In database theory the field or combination of fields that uniquely
identify the record are referred to as the primary key. If you add an
autonumber field you would call it a surrogate key. But Access refers to
an autonumber field as a primary key, which I consider to be a serious
flaw in its design.

So in any table you need a primary key. You can add a surrogate key as
well if you want, but you still need that real primary key as well.




--
Bernard Peek