[AccessD] OT: The Great Primary Debate

DWUTKA at marlow.com DWUTKA at marlow.com
Mon Jun 21 10:28:46 CDT 2004


I have to disagree about a PK/AN being meaningless.  Yes, you shouldn't
force 'rules' on a AN, to make it meaningful (such as it having to be
sequential without a miss, etc.), but by it's very nature, being unique, it
has meaning.

For example, on our company's website, when someone goes to their shopping
cart, if a cart doesn't 'exist' for them, one is created.  It is given a
CartID, which is an AN.  Now, when they go to purchase their cart, I have to
send the CC site a unique 'ID' for that transaction.  I use the CartID.  It
doesn't have to be truly sequential, just absolutely non-repeating, or in
other words, unique.  The CartID fits the bill to a tee.  The numbers may be
sent 'backwards' sometimes, where one user has a cart created, and then
another user creates a new cart, and orders it, before the first user does
(so the numbers are sent in reverse order to the CC company).  Their site
doesn't care, as long as the number wasn't used before.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Haslett,
Andrew
Sent: Tuesday, June 08, 2004 11:48 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] OT: The Great Primary Debate


IMO the PK shouldn't be meaningful, and shouldn't be used in any
calculations at all, so it shouldn't matter if its perfectly sequential or
not.

It's just there to uniquely identify records and used internally in
relationships.  An Autonumber PK fits the bill perfectly in Access, just as
an Identity integer field in SQL Server does.  Because its meaningless it
will never need to be changed and hence won't cause the problems that would
occur when using a natural key.

My 2 cents...  I never really understand what the arguments about, but
hey... 'whatever floats your boat'


-----Original Message-----
From: Stuart McLachlan [mailto:stuart at lexacorp.com.pg] 
Sent: Tuesday, 8 June 2004 9:07 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] OT: The Great Primary Debate

On 7 Jun 2004 at 13:27, Ken Ismert wrote:

> 
> 3. That's why I said auto-generated! This is where relying on a ANPK can
> cause you problems: you can't extend the table without ruining your
> calculations.
>

> For regular, sequential data (no interruptions) with a single field
natural
> key, or any data where a unique key can be mathematically calculated (as
> above), you can make an argument that ANPK is redundant, and can actually
> make the data more difficult to work with. This is where intent of the
data,
> and your data modeling style, plays the deciding role in your PK choice.
> 

In your data dimension table example, you are creating a meaningful field 
SequentialDateNumber (which you are calling ID) and are using it in data 
calculations.  

Thr real question in this situation is not whether you use this natural key
as 
a PK, but whether you have a PK in the table at all - which comes down to
the 
sub-debate about "what is a PK and what is it used for" :-)

















 
-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System Support.



-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

IMPORTANT - PLEASE READ ******************** 
This email and any files transmitted with it are confidential and may 
contain information protected by law from disclosure. 
If you have received this message in error, please notify the sender 
immediately and delete this email from your system. 
No warranty is given that this email or files, if attached to this 
email, are free from computer viruses or other defects. They 
are provided on the basis the user assumes all responsibility for 
loss, damage or consequence resulting directly or indirectly from 
their use, whether caused by the negligence of the sender or not.
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list