Answer the question
In order to leave comments, you need to log in
What is the name of the primary key?
I argued with a colleague about the name of the key, he speaks for a meaningful name that reveals the essence of the column, but I think that the primary key, in most cases, should be called ID.
the meaning of the field (as well as the primary key) is to be an identifier of this record in the table
to make it easier, the colleague suggests that the fields be conditionally book_code, although this is a normal auto-increment column
Please tell us what is the truth (:
Answer the question
In order to leave comments, you need to log in
I think that the primary key, in most cases, should be called ID.I agree.
A non-composite key as a column can be called simply id, you can name_table_id. In my opinion, both options are acceptable.
It is important to stick to one standard as soon as possible, because This will have a positive effect on various types of automation.
table_id_name can be more beneficial if you have two different tables but semantically have the same primary key. Those. It has only one business sense. Also in selections where short one-two letter sequences are used as aliases and several id are selected, it can be difficult to understand which id is from which table. In general, I lean towards the option with meaningful names, because a meaningful name is better than a non-meaningful one; I would choose table_name_id.
It makes sense to call the primary key itself as a constraint: pk_table_name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question