Franc Stratton's .NET (TM) Web Application, OOP, and SOA Architecture & Programming Site

A site devoted to ASP.NET (TM), SilverLight (TM) and Browser-Based WPF (TM) Applications, IIS Services, and OOP Architectures

Home     Architecture Overview     WF/WCF/WPF     Data Store     Standards     .NET Security     Resources     jQuery     Silverlight     Developer Tips     Blog     Site Map      
Tables
Columns
Stored Procedures
Backup/Restore
Keys/Indexes
ERDs
SQL Injection
Table Identities
Table Names

1. The table name must clearly identify the collection of data the table represents or contains: e.g., Activity, Addresses.

 

2. Table names are the only database objects not prefixed since they often represent objects, private fields, and public properties. Most standards call for tables to be plural like a collection of row objects similar to instances of a class: e.g., Clients. This is not a static rule, however.

3. Only the first letter of each whole word in a table name should be capitalized: e.g., BusinessContacts.

 

4. Functional table names (for many-to-many relationships) should be a combination of the two tables referenced. For example, indexes the many-to many relationships between Subprojects and Documents.

 

5. Lookup tables should be grouped together. They can be grouped at the end by a name like ‘_lkup’ or ‘_LookUp’: e.g., NamePrefixes_LookUp or NamePrefixes_lkup.

 

6. Names of all database objects and constraints all prefixed with lower case identifier

    Object Type Examples:


    Views vw_ + TableName or v + ViewName(If it is combination of more than one table)
    Stored Procedures usp_ + ”procedure_name”
    Primary Keys pk_ + TableName
    Foreign Keys fk_ + ForeignKey + _ + Ref TableName
    Index ix_ + TableName + _ + ColumnName

7. Triggers are named to indicate the table they are for and the type of trigger. The purpose of the trigger is identified in the prefix to the name. All triggers should be prefixed with the letters 'tr_', letters designating the type, an underscore, and the table name. The type should be designated as 'Insert' = insert, 'Update' = update, 'Delete' = delete. Example tr_Insert_Products (Insert trigger for Products Table)