数据库名称约定:DATETIME列 [英] Database name convention: DATETIME column

查看:64
本文介绍了数据库名称约定:DATETIME列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DATETIME列的命名约定是什么(在我的情况下,使用MS SQL Server)

What is your naming convention for DATETIME columns (in my case, using MS SQL Server)

对于存储行创建时间的列 CreatedDatetime LastModifiedDatetime .

For a column that stores when the row was created CreatedDatetime makes sense, or LastModifiedDatetime.

但是对于一个简单的表,假设一个名为Event的表,您是否会创建一个名为:

But for a simple table, let's say one called Event, would you create columns called:

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, etc.

I normally name DATETIME columns as ACTION_WORD_on: created_on, completed_on, etc.

ACTION_WORD定义列所代表的内容,后缀(_on)表示该列代表时间.

The ACTION_WORD defines what the column represents, and the suffix (_on) indicates that the column represents time.

其他后缀(甚至是前缀)可用于指定数据类型(_at_UTCwhen_等).

Other suffixes (or even prefixes) may be used to specify the data type (_at, _UTC, when_, etc).

具有描述性.保持一致.

Be descriptive. Be consistent.

这篇关于数据库名称约定:DATETIME列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆