|
I want to know why I should use an int as a lookup table's primary key instead of just using the lookup value as the primary key (which in most cases would be a string). I understand that using a nvarchar(50) rather than an int would use way more space if it is linked to a table with many records. But on the other hand using the lookup value directly would basically save us doing a join. I can imagine this would be a big saving if the join is always required. What are the advantages of using a int primary key (specifically for a lookup table) other than it being "the standard thing to do"?
(comments are locked)
|
|
Kevin's answer is absolutely fantastic, but I think no discussion on primary keys can be complete without considering the pros and cons of natural, artificial, and surrogate keys, and the best place for that is Joe Celko's article at http://www.informationweek.com/news/software/bi/showArticle.jhtml?articleID=201806814
(comments are locked)
|
« previous 1 2

