SQL Server database naming rules

Source: Internet
Author: User

Good naming habits are a virtue. Below are the naming rules for databases compiled by individuals:

 

Database naming rules: 1. Database Name: 1.1) Name the product or project; 1.2) Pascal case, such as adventurework; 1.3) Avoid special characters, such as numbers, underscores, and spaces; 1.4) Avoid abbreviations 2. Table Name 2.1) use the plural value, Pascal case, and the plural value can only be added to the last word, such as products, users, and userroles. 2.2) Avoid special characters, such as numbers, underscores, and spaces; 2.3) Avoid abbreviations 3. Column name 3.1) Use Pascal case 3.2) avoid repeated table names and avoid data type prefixes such as: int 3.3) avoid abbreviations or special characters 4. Stored Procedure 4.1) Add a table name to the verb to describe the Operation Type 4.2) prefix: SP + { "Insert", "Update", "delete", "get", "Validate ",...} 5. View 5.1) reference table name rules
5.2) prefix with "VW"
  6. triggers 6.1) use the "Trg" prefix 6.2) use the operation type + Table name, for example: Trg_productsinsert
  7. Index 7.1) The format is as follows:Idx _ {table name }_{ index column name }_{ unique/nonunique }_{ cluster/noncluster}
  8. Primary Key 8.1) format used: pK _ {table name }_{ primary key column name} 9. Foreign key 9.1) The format is as follows: FK _ {name of the primary table }_{ name of the column in the primary table }_{ name of the referenced table }_{ name of the column in the referenced table} 10. Default 10.1) use format such as: DF _ {table name }_{ column name} 11. Constraints 11.1) The format is as follows: CK _ {table name }_{ column name}
  12. Variables 12.1) refer to column name rules

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.