[Database] database naming rules

Source: Internet
Author: User

The data file name adopts the system name + _ + file type. For example, if the system name is kupage, the database file is named kupage_database.mdf. Some database files have multiple, for example, SQL Server has two, one is a database file, and the other is a log file. Their files are named kupage_database.mdf and kupage_log.log respectively. All file names are in lower case.

Database Table naming rules: The table name cannot exceed 30 characters. The table name contains all words in the singular form. The first letter of a word must be in uppercase, and no connection symbol is required between multiple words. If there are multiple systems in the database, the table name is system name + word or multiple words. The system name is short for the development system. The system name is all lowercase English characters, such as bbstitle and bbsforumtype. If the database contains only one system, the table name uses only one or more words. Select one or more English words that can summarize the table content, such as userinfo and usertype. The name of a joined table is re_table A _ table B, and RE is the abbreviation of relative, such as re_user_articletype and re_user_formtype.

Database field naming rules: database Field names are all lowercase English words separated by "_". Naming rules are table alias + word, such as user_name and user_pwd. Table alias rules. If the table name is a word, the first four letters of the word are used as the alias. If the table name is a word, take the first two letters of each word to form an alias with four letters. If the table name is composed of three words, take one of the first two words and then two more letters from the last word. The result is a 4-letter alias.

The view name uses rule VIEW _ Table A _ table B _ Table C, and view indicates the view. When several tables are generated in this view, use "_" to connect the names of several tables. If there are too many tables, you can simplify the table name properly, but you must list all the table names.

Stored Procedure naming rules: P _ TABLE name_access procedure name (abbreviation), such as p_user_del and p_articletype_adddata.
Rules for writing SQL statements. keywords must be capitalized. For other statements, follow the naming rules described above. For example:
Select user_id, user_name from user where user_id = 'Tom'

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.