Database design 数据库表公共ID的命名约定是什么
假设我的桌子的名字是Database design 数据库表公共ID的命名约定是什么,database-design,Database Design,假设我的桌子的名字是 Entries 那么表的id列将是 EntryID 但是公众身份证呢?以下是一些备选方案以及我的问题: EntryID_public - postfix should be for content (_on), underscore should be avoided EntryID_Public - postfix should not have uppercase EntryIdPublic - could work, but acronyms with two l
Entries
那么表的id列将是
EntryID
但是公众身份证呢?以下是一些备选方案以及我的问题:
EntryID_public - postfix should be for content (_on), underscore should be avoided
EntryID_Public - postfix should not have uppercase
EntryIdPublic - could work, but acronyms with two letter should be capitalized according to some.
PublicID - too anonymous column name, no reference to its content
EntryIDPublic - three character acronym, looks bad and is hard to read.
到目前为止,我认为最好的选择是最好的。标准怎么说
标准怎么说
我不认为有任何这样的命名标准。你可以根据你的可读性和易读性来命名
我更喜欢把它命名为EntryID\u public,但这一切都取决于一个人的容易程度和选择。许多人可能会争辩,因为他们会发现任何其他公约都更具可读性。但是就命名约定标准而言,没有这样的标准。虽然没有固定的规则,但多年来我已经学习并使用了一些约定。首先,我避免在表中使用复数名称。这简直令人困惑。在您的示例中,我将表命名为
entry
然后,id将是条目\u id
在我的约定中,_id指定条目_id是该表的主键,它通常是一个数字序列号
我使用的其他主键类型:
- 表_代码:一个字符键李>
- 表guid:生成的guid李>
- 创建时间:创建时间戳
- 更新时间:更新时间戳