Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database Naming Conventions by Microsoft?

I found Naming Guidelines from MSDN, but is it any guideline for MSSQL database from Microsoft?

like image 616
Cheung Avatar asked Aug 29 '10 05:08

Cheung


People also ask

What are naming conventions in a database?

Naming conventions are a set of guideline that make strong foundations for such a consistent system. These guidelines ensure that the names of database entities are readable, easy to use in queries and do not collide with names of other defined entities or keywords.

What are the MS Access naming conventions?

Database Object Naming Conventions The Leszynski/Reddick Guidelines for Microsoft Access is the most commonly used naming convention for Access objects. These Guidelines as published in SmartAccess, suggest that all objects should have a descriptive tag, placed at the start of the object name.

What is the best practice naming convention for SQL?

When naming tables, you have two options – to use the singular for the table name or to use a plural. My suggestion would be to always go with names in the singular. If you're naming entities that represent real-world facts, you should use nouns. These are tables like employee, customer, city, and country.

Which are correct guidelines for naming database tables?

The rules for naming database objects (such as tables, columns, views, and database procedures) are as follows: Names can contain only alphanumeric characters and must begin with an alphabetic character or an underscore (_). Database names must begin with an alphabetic character, and cannot begin with an underscore.


2 Answers

The naming conventions used in SQL Server's AdventureWorks database demonstrate many best practices in terms of style.

To summarize:

  • Object names are easily understood
  • Table names are not pluralized ("User" table not "Users")
  • Abbreviations are few, but allowed (i.e. Qty, Amt, etc.)
  • PascalCase used exclusively with the exception of certain column names (i.e. rowguid)
  • No underscores
  • Certain keywords are allowed (i.e. Name)
  • Stored procedures are prefaced with "usp"
  • Functions are prefaced with "ufn"

You can find more details here:

One caveat: database naming conventions can be very controversial and most database developers I've met have a personal stake in their style. I've heard heated arguments over whether a table should be named "OrderHeader" or "OrderHeaders."

like image 182
8kb Avatar answered Sep 23 '22 08:09

8kb


No, there isn't but the practices in the link you provided are good to keep in mind.

With respect to naming stored procedures - do not prefix them with "sp_" You can read more about why in this link:

"Do not prefix stored procedures with sp_, because this prefix is reserved for identifying system-stored procedures."

like image 34
OMG Ponies Avatar answered Sep 23 '22 08:09

OMG Ponies