Show Menu
Cheatography

Sql Naming Conventions Cheat Sheet (DRAFT) by

Naming Conventions for Data Objects

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Entitty

From Entity Descri­ption
Meaningful to user.
Reflects business data domain.
Noun or noun phrase.
Don't use Organi­zation name.
Pascal case with a space between words.
DEPLOYMENT EVENT, PERSON CATEGORY
No Numbers.
Limit abbrev­iations and acronyms
“EMPLO­YEE”, NOT “EMPLO­YEES”.

Database

“MISO_” + System Acronym
Request to ITSO for new DB
MISO_BFMS, MISO_P­BMS.., ETC.

Table

Entity names without spaces.
Do not prefix with ‘tbl’.
Do not use unders­cores except to indicate the associ­ation table (resolve many to many relati­ons­hip).
ENTITY DEPLOYMENT EVENT BECOMES TABLE DEPLOY­MEN­TEVENT
“CUSTOMER” TABLE AND “PRODUCT” TABLE HAS MANY TO MANY RELATI­ONSHIP. THE ASSOCI­ATION TABLE MAY BE NAMED AS “CUSTO­MER­_PR­ODUCT” TO INDICATE THE TABLE IS AN ASSOCI­ATION TABLE.
 

Attribute

Must be unique within an entity.
Be descri­ptive and meanin­gful.
Don’t use the DoD class word as the suffix in the name.
Use Pascal case and leave a space between the words
Limit abbrev­iations and acronyms. If used they are ALL CAPS.
If foreign key Then attribute name = same as it appears in the parent.
Verify parent­/child relati­onships are correct.
“PERSON” ENTITY MAY HAVE A CHILD “FEDERAL EMPLOYEE” ENTITY. PERSON IDENTIFIER FROM PARENT ENTITY IS THE FOREIGN KEY IN CHILD ENTITY. A FEDERAL EMPLOYEE MAY HAVE A SUPERVISOR AND A TIME CLERK PERSON. THEREFORE, “PERSON” ENTITY HAS 2 RELATI­ONSHIPS WITH “FEDERAL EMPLOYEE” ENTITY. THE FOREIGN KEY NAME SHOULD BE NAMED TO REFLECT THE CORRES­PONDING ROLE. AS AN EXAMPLE, ONE MAY BE NAMED AS “SUPER­VISOR PERSON IDENTI­FIER” AND ANOTHER MAY BE “TIME CLERK PERSON IDENTI­FIER”.
 

Column

Attribute name without spaces.
Don't prefix with "­col­" or unders­core.
Don't use reserved SQL keywords.
Primary Key should be surrogate key
FOR “DEPLO­YME­NTE­VENT” TABLE, THE SURROGATE PRIMARY KAY MAY BE NAMED AS “DEPEN­DEN­TEV­ENTID”
Don't add audit columns.
INSERT­USERID, INSERT­DAT­ETIME, UPDATE­USERID, UPDATE­DAT­ETIME, TIMESTAMP AND ROWVERSION