Microsoft SQL Database Naming Conventions
You mentioned finding Microsoft's Naming Guidelines from MSDN, but wondered if there were specific guidelines for Microsoft SQL Server (MSSQL) databases.
The AdventureWorks database included with SQL Server provides practical guidance for database naming best practices:
Naming Conventions:
-
Readable Object Names: Names should be straightforward and easily understandable.
-
Singular Table Names: Table names should not be pluralized (e.g., "User" instead of "Users").
-
Limited Abbreviations: Abbreviations can be used sparingly (e.g., "Qty," "Amt," etc.).
-
PascalCase: PascalCase is used for all objects, except for certain column names (e.g., "rowguid").
-
No Underscores: Underscores are not used.
-
Allowed Keywords: Certain keywords are allowed for table names (e.g., "Name").
-
StoredProcedure Prefixes: Stored procedures are prefixed with "usp."
-
Function Prefixes: Functions are prefixed with "ufn."
Additional Details:
- [AdventureWorks Data Dictionary](link)
- [Stored Procedures in AdventureWorks](link)
- [Functions in AdventureWorks](link)
Cautionary Note: Database naming conventions can be subjective, and different developers have their preferences. Be prepared for potential discussions or debates when selecting naming conventions.
The above is the detailed content of What are Microsoft SQL Server Database Naming Conventions?. For more information, please follow other related articles on the PHP Chinese website!