Naming rules for databases

Source: Internet
Author: User

Naming rules for databases
Naming conventions for databases, tables, fields, views, triggers, stored procedures, variable names, primary keys, foreign keys, indexes, and so on during database development.

1) Data Base (database)
Database name = database Content ID (capitalized in the first word).

2) tables (table)
The naming should reflect the stored data content as much as possible.
Table name prefix: A unified identity is obtained from the table and the contents of a series of tables associated with the table.
Table name = T + ' _ ' + table name prefix + ' _ ' + table content identifier (capitalized in the first word). In the database, both the table name and the field name are in English, no other languages are allowed, and the original

Field names, preserving their specifications.
The name of the table names in the database is generally not allowed to appear, if there are several words, each word is not allowed to leave a space, separated by "_"; the first letter of each word must be capitalized, if too long, in order not to increase the difficulty of programming can be abbreviated, each word may be three to four letters, Can also be based on the actual situation, the practical habit of abbreviations.

3) fields (field)
A field is the most widely used in a database, and it has a very large type, so you must prefix it with a type to indicate its type.
Field name = F + field type prefix + field content identifier (capitalized in first word).

4) View name
The name of the view = "V_" + the contents of the view (capitalized in the first word), such as V_record.

5) Trigger name (Triger)
Trigger type Trigger Identity: operation-type = trigger identification Insert-before =bi Insert-after=ai
Trigger name = "TR" + Trigger Identity + "_" + corresponding table name.

6) Stored procedure name (Procedure)
Stored procedure operation prefix: operation = prefix
insert= I delete= D update= U other= O
Stored Procedure name = Pro + "prefix" + "_" + Stored procedure content ID (capitalized in first word).
7) variable name (Variable)
The first letter of each word is capitalized, and other suggestions in naming:

1. Prohibit the use of Chinese names.
2. The variable name must not exceed the system limit of 30 characters.
3. The names are all English characters, and the first letter of each word should be capitalized.

8) Primary KEY (Primary key)
NID.

9) indexing (index)
The idx+ field identification.

Naming rules for databases

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.