SQL Server Naming conventions

Source: Internet
Author: User
Tags naming convention

Naming conventions

Table

Table names such as order/useraccout

Complies with the following specifications:

1. Uniform use of singular form, against Orders

2. Capitalize the first letter, multiple words, capitalize the first letter of the word, oppose Order/useraccout/order

3. Avoid Chinese pinyin and oppose Agentbaoci

4. Avoid underline connections, against User_accout (underline applies to Oracle database)

5. Avoid long names and oppose Websiteinfomationmodifyrecord

6. Many-to-many relationship tables, ending with mapping, such as userrolemapping

7. Avoid reserved words

Field

Field names such as Userid/username/usertype

Complies with the following specifications:

1. First letter lowercase, multiple words, the first letter of the word capital, against Userid/userid

2. Must have a primary key, the primary key is not directly with the ID, but the table name +id, such as Userid/orderid

3. Common field name, not directly with name, but table name +name, such as username/ordername

4. Common fields desc, not directly with desc, but table name +desc, such as userdesc/orderdesc

5. Must contain at least two lowercase letters before the capital letters, against uid/oid

6. Avoid Chinese pinyin

7. Avoid the underline connection

8. Avoid too long a name

9. Avoid reserved words

Object

1. Stored procedures are prefixed with sp_

2. Trigger is prefixed with tr_

3. The function is prefixed with fn_

4. The primary key is prefixed with pk_

5. Index is prefixed with ix_

6. Capitalize the first letter of the prefix, with multiple words, capitalize the first letter of the word, such as Sp_countfee

7. All letters of all keywords must be capitalized, such as SELECT userid,username from User

SQL Server naming convention

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.