SQL Server database Naming conventions

Source: Internet
Author: User

A good naming habit is a virtue, the following is a personal collation of the database naming conventions:

Database naming specification: 1.         Database name: 1.1) name of the product or project; 1.2) Pascal case, such as adventurework; 1.3) Avoid using special characters, such as numbers, underscores, spaces, etc. 1.4) avoid using abbreviation 2.  Table name 2.1) Use the plural, Pascal case, and the complex number is only added on the last word as: Products,users,userroles 2.2) Avoid using special characters such as numbers, underscores, spaces, etc. 2.3) avoid abbreviations 3. Column name 3.1) Use Pascal case 3.2) to avoid duplication with the table name, avoid data type prefixes such as: Int 3.3) Avoid using abbreviations or special characters
4. Stored procedure 4.1) Use verb plus table name to describe operation type 4.2) using prefix: sp+{"Insert", "Update", "Delete", "Get", "Validate",...}
5. View 5.1) Reference table name rule
5.2) prefix with "VW"
6. Triggers 6.1) prefix with "TRG" 6.2) Use the action type + table name, such as: Trg_productsinsert
7. Index7.1) Use format such as: idx_{table name}_{index column name}_{unique/nonunique}_{cluster/noncluster}
8. Primary key 8.1) use format such as: pk_{table name}_{primary key column name}
9. Foreign key 9.1) Use the format such as: fk_{Main Table name}_{the column name of the primary table}_{the reference table name}_{the column name of the reference table} 10. Default 10.1) Use format such as: df_{table name}_{column name}
11. Constraint 11.1) Use format such as: ck_{table name}_{column name}
12. Variable 12.1) refer to the column name rule

SQL Server database Naming conventions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.