Subscribe to Subscribers

Resources » .NET programming » Databases

Database Guidelines


Posted Date:     Category: Databases    
Author: Member Level: Gold    Points: 15


Guidelines for database design. It will help user to design effective strategies for proper databases.



General:

All the names (i.e. Table name, column name, SP names etc) will follow the Pascal Case. For e.g. ThisIsAnExampleOfPascalCasing
Exceptions to this rule are the abbreviations like <PROJECTNAME> etc.

Table Names:

All table names will begin with the name of the Entity it relates to. For example tables related to Resource or Image Gallery will be like Resource, ImageGallery.
Another example Product, Company
Table names would not be plural.

Column Names:

Column names should be meaningful. They should not use incomplete words. For e.g. UpdateDate should not be written as ‘UpdDate’ etc. The word "Date" would be used and it would be suffixed.

Stored Procedures:

All Stored procedure name will begin with the name of the Table it primarily queries, followed by the verb. Thus the format will be {tablename}{verb}.
For e.g. ProductAdd, ProductUpdate, ProductGetAll etc.

Functions/ Views/ Triggers:

All Functions/Views/Trigger name will begin with the name of the Table it primarily queries, followed by the verb.
Thus the format will be {tablename}{verb}.

Moreover, for functions "_fn" will be appended. Thus the format would be {tablename}{verb}_fn.
Similarly for Views "_vw" will be appended. Thus the format would be {tablename}{verb}_vw.
And for Triggers "_trg" will be appended. Thus the format would be {tablename}{verb}_trg.

Tables(many to many relationship tables):

Product Feature and Product Detail tables will separate two tables by the underscore character.
For e.g. Product_Feature, Product_Detail. Underscores will be used only to indicate this table is related to product.

Primary Key/Foreign Key:

The primary key of a table will be defined as TableName[Id](i.e. Table name suffixed by the word ‘Id’). For e.g. ProductId(Product), CompanyId(Company)
The prefix pk or fk would not be used.

Moreover, specify description for all tables and each columns of table. Whenever you add new column or table to database, make sure you have added a description for the same. That will enable to understand the use of specific column in the project.

For performance consideration, you need to envisage creating indexes for the tables in database which has most searched columns. There will be an increasing number of records, and admin need reports with search facility based on parameter.

Types of Indexes in SQL 2005


There are cluster and non cluster indexes in SQL 2005:
CLUSTER INDEX

- A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index.
- The leaf nodes of a clustered index contain the data pages.
- Cluster index is applies to columns that contain a large number of distinct values. It applies to columns that are accessed sequentially.
- It applies to queries that return a range of values using operators such as BETWEEN, >, >=, <, and <= or which return large result sets.
NON - CLUSTER INDEX

- A non-clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. Per table only 249 non clustered indexes.
- The leaf nodes of a non-clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.
- Non-cluster index applies to the data rows that are not sorted and stored in order based on their non-clustered keys.
- Each index row contains the non-clustered key value and one or more row locators that point to the data row (or rows if the index is not unique) having the key value.





Did you like this resource? Share it with your friends and show your love!


Responses to "Database Guidelines"
Author: Vikram Singh Saini    31 Mar 2010Member Level: Gold   Points : 1
Hi Angna,

Excellent article for database designing. I liked each and every line written.

This will really help the developers or fresher to learn the some sort of standard way.

Keep posting such good resources.

Thanks and Regards,
Vikram Singh Saini



Author: Angna Upadhyay    31 Mar 2010Member Level: Gold   Points : 0
Your welcome Vikram...


Author: Mahesh Dhiman    01 Jul 2012Member Level: Bronze   Points : 0
Hi Angna,

This is very useful for all, which want to design database.

In SQL Server 2008, 999 Non-clustered Indexes per table.



Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Using DataSet To Retrieve Data From Database
    Previous Resource: Union and Union All
    Return to Resources
    Post New Resource
    Category: Databases


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    DB guidelines  .  Database guidelines  .  Indexes  .  Cluster indexes  .  Non cluster indexes  .  DB Guide lines  .  Cluster Index  .  SQL Indexes  .  SQL 2005 Indexes  .  

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2013 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.