True or False: Good design calls for every table to have a primary key, if nothing else, a running i

Posted by Velika on Stack Overflow See other posts from Stack Overflow or by Velika
Published on 2010-03-06T00:31:09Z Indexed on 2010/05/18 2:40 UTC
Read the original article Hit count: 219

Consider a grocery store scenario (I'm making this up) where you have FACT records that represent a sale transaction, where the columns of the Fact table include

SaleItemFact Table
------------------
CustomerID  
ProductID  
Price  
DistributorID  
DateOfSale  
Etc  
Etc  
Etc  

Even if there are duplicates in the table when you consider ALL the keys, I would contend that a surrogate running numeric key (i.e. identity column) should be made up, e.g., TransactionNumber of type Integer.

I can see someone arguing that a Fact table might not have a unique key (though I'd invent one and waste the 4 bytes, but how about a dimension table?

© Stack Overflow or respective owner

Related posts about data-warehouse

Related posts about database-design