Naming conventions for database tables

Source: Internet
Author: User
Tags aliases naming convention

Naming specification database naming conventions for database tables

  • Data files
  • Database tables
    • Only one system
    • There are multiple systems
    • Association table name
  • database field Naming conventions
  • Other
    • View Name
    • Stored Procedure Name
    • SQL statements

Original link

Data files

The data file name takes the system name _ file type, for example the system name is Kupage, the database file is named Kupage_database.mdf, some database files have several, for example SQL Server has 2, one is the database file, the other is the log file, Then their files are named Kupage_database.mdf,kupage_log.log, respectively. Filenames are all lowercase.
Summary: System name _ file type

Database tables have only one system
  1. Length cannot exceed 30 characters

  2. Words are all in singular form

  3. Capitalize the first letter of the word

  4. No connection symbols between multiple words
    E.g:userinformation

There are multiple systems
    1. System name + table name when a single system

    2. The system name is abbreviated and all lowercase letters are used

    3. Do not use any connection symbols
      E.g:bbsuserinformation

Association table name

The Guan Lianqua naming convention for re_ Table A_ table B,re is an abbreviation for relative, such as: Re_user_articletype, Re_user_formtype.

database field Naming conventions
    1. database field names are all lowercase English words, separated by "_" between the words

    2. Naming rules are table aliases + words, such as: User_name,user_pwd.

Table alias rules

    1. If the table name is a word, the alias takes the first 4 letters of the word;

    2. If the table name is two words, the first two letters of each of the two words are composed of 4 letters long aliases;

    3. If the name of the table consists of 3 words, you may want to take one from the first two words and then remove the two letters from the last word, and the result is a 4-letter long alias.

Other view names

The view name takes the rule view_ table A_ table B_ Table C,view represents the view. This view is generated by several tables and joins the names of several tables with "_", and if you have too many tables you can simplify the table names appropriately, but be sure to list all the table names.

Stored Procedure Name

Stored procedure naming rules P_ the name of the Access procedure (abbreviated), such as P_user_del,p_articletype_adddata.

SQL statements

SQL statement Writing rules, keywords must be uppercase, other writing according to the above naming rules, such as:
SELECT user_id, user_name from user WHERE user_id = ' Tom '

Naming conventions for database tables

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.