Quantcast
Channel: True or False: Good design calls for every table to have a primary key, if nothing else, a running integer - Stack Overflow
Viewing all articles
Browse latest Browse all 6

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

$
0
0

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?


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images