Naming of ID columns in database tables

后端 未结 23 790

I was wondering peoples opinions on the naming of ID columns in database tables.

If I have a table called Invoices with a primary key of an identity column I would c

23条回答
  •  余生分开走
    2020-11-29 18:20

    For the column name in the database, I'd use "InvoiceID".

    If I copy the fields into a unnamed struct via LINQ, I may name it "ID" there, if it's the only ID in the structure.

    If the column is NOT going to be used in a foreign key, so that it's only used to uniquely identify a row for edit editing or deletion, I'll name it "PK".

提交回复
热议问题