Database-Design.org presents

Database Design Question #20

How do you name your primary identity fields?

Assem Bayahi, Mourouj 1, Tunisia: I like the simple and significative name ID : it's « universal » and anyone how see it will know directly that it's the primary key.

Md. Obaidul Haque Sarker, Dhaka, Bangladesh: I follow the naming convention of each entities and attributes. Primary key may be single field or multiple fields. Normally, I follow the single field for primary key which is incremental value. Other fields which identify the row in a table uniquely, I create a composite unique key constraint in that case.

Bruce Bray, Phoenix, Arizona: I name all of my identity fields with the name of the table, added the Uppercase ID at the end. For example CustomerID for the Customer table (not to be confused with a counter field or other indexed fields which I have a different naming system for)

Temitayo Ilori, Berea, Ohio: I name it in such a way that it shows it’s a primary kei, e.g “IDNO”

Julie Hogue, Akron, Ohio: I always include an Autonumber field as the primary identifier. This also allows a smoother transition to SQL data storage.

Grace Elaiza Seballos, Davao City, Philippines: I have 2 kinds of tables. I call them transaction tables and library tables. And each of them have standard fields that will always be there. But I will not delve further about that in details. In both of those tables, there is always an "ID" field and a "Code" field. The "ID" is the primary key. The "Code" is not the primary but is a unique field. The ID is always system generated. And that is used to connect with a foreign key. The "Code" field is not related to anywhere but will just be a unique field. It is exposed to users for editing (if the client wishes) or also a system generated field. As opposed to the "ID" field, the ID is invisible to the users. This way, the users can keep changing the "Code" of a product, but will not affect the foreign keys anywhere because the "ID" is the primary key.