DATETIME 列的命名约定是什么(在我的例子中,使用 MS SQL Server)
对于存储行创建时间的列,CreatedDatetime 或 LastModifiedDatetime 是有意义的。
但是对于一个简单的表,假设一个名为 Event 的表,您会创建名为的列吗:
EventID, // Primary key
EventDatetime, // When the event is happening
EventEnabled // Is the event is on
或
ID, // Primary key
Datetime, // When the event is happening
Enabled // Is the event is on
如果您既不使用约定:请提供您要使用的列名。
最佳答案
我通常将 DATETIME 列命名为 ACTION_WORD_on:created_on、completed_on 等
ACTION_WORD
定义了该列代表什么,后缀(_on
)表示该列代表时间。
其他后缀(甚至前缀)可用于指定数据类型(_at
、_UTC
、when_
等)。
具有描述性。保持一致。
关于sql-server - 数据库名称约定 : DATETIME column,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1379543/