What is your naming convention for DATETIME columns (in my case, using MS SQL Server)
For a column that stores when the row was created CreatedDatetime makes sense, or LastModifiedDatetime.
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
or
ID, // Primary key Datetime, // When the event is happening Enabled // Is the event is on
If you'd use neither convention: Please provide the column name you would use.
If you use TIMESTAMP then you don't have to specify a column name and SQL Server will create a column "TimeStamp" for you. But it is recommended to use "ROWVERSION" data type and in this case you have to specify the column name.
Column names must contain only A to Z, 0 to 9, and underscore (_) characters. Column names can contain multiple underscores. The column name must not be very generic. Avoid words such as term, multiplier, description, name, code, and so on.
Database object names, particularly column names, should be a noun describing the field or object. Avoid using words that are just data types such as text or timestamp . The latter is particularly bad as it provides zero context. Underscores separate words.
I normally name DATETIME columns as ACTION_WORD_on: created_on, completed_on, etc.
The ACTION_WORD
defines what the column represents, and the suffix (_on
) indicates that the column represents time.
Other suffixes (or even prefixes) may be used to specify the data type (_at
, _UTC
, when_
, etc).
Be descriptive. Be consistent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With