Red Wei
Red Wei

Reputation: 940

Id field should be number only or contains a letter?

It's a common question. Every table has atleast a primary key, so which type of data that primary key should be? Number only like 1/2/3/4 or we add some letters like A1/A2/A3 to distinguish which id belongs to which table?

Upvotes: 0

Views: 610

Answers (1)

nvogel
nvogel

Reputation: 25526

If your key is a business key then the business needs should be the determining factor. Alphanumeric keys are often easier for people to use. Ideally a key should be familiar, simple and stable.

If the key is a surrogate then what's most important is the efficiency of generating and storing it. Most often it is just a sequential number.

Upvotes: 1

Related Questions