Data file naming
Mode 1: Data file naming takes system name +_+ file type. mdf, such as system name Comsys, the database file is named
Comsys_database.mdf, there are several database files, such as SQL Server has 2, one is the database text
And the other is log files, then their files are named Comsys_database.mdf, Comsys_log.log, respectively.
Mode 2: If the database takes a file system instead of a bare device, contract the following naming conventions:
1) The data file begins with the table space name and ends with a. DBF, all in lowercase English letters plus numbers. If the table space has multiple data files, start with the 2nd data file and add _ after the table space name.
Example: Data file for system table space: SYSTEM.DBF,SYSTEM_2.DBF
2) control files for Oracle database are represented by CONTROL.CTL. such as Control01.ctl,control02.ctl.
3) log files for Oracle database, online log files are represented by redo< group name >< file sequence name >.dbf. The group name and file sequence name are represented by a 2-digit number. As the first group of two files represent bits redo0101.dbf and redo0102.dbf. Archive logs are represented by ARCH_%T_%S.ARC. Where%t and%s are the variables that are contracted by Oracle.
Database object Naming Conventions
database objects include tables, views (queries), stored procedures (parameter queries), Functions, constraints. The name of the object consists of a prefix and a real name, not exceeding 30.
1) Prefix:
Use lowercase letters. Such as:
Tables (table) tb_
Field (Column)
Primary KEY (Primary key) Pk_
Foreign key (Foreign key) Fk_
Check constraint (check Constraint) ck_
Default constraint (default Constraint) df_
Views (view) Vi_
Indexing (Index) idx_
Stored procedure (Stored procedure) sp_
User-defined functions (user-defined function) fn_
Sequence (Sequence) seq_
Table Space (tablespace) Ts_
Variable name (Variable) @
Trigger (Trigger) tr_
2) Actual name:
The actual name as much as possible to describe the contents of the entity, by word or word combination, the first letter of each word capitalized, other
The letter is lowercase and does not begin with a number and _. Such as:
Table User_info
View User_list
Stored Procedure User_delete
3) Example:
The legitimate object names are similar to the following:
Table Tb_user_info Tb_message_detail
View Vi_message_list
Stored Procedure Sp_message_add
Name of table
The table name consists of a prefix and a real name. The prefix uses the lowercase letter tb_, which represents the table, "Tb_" + name (name to use English words as much as possible, capitalize the first letter of each word).
1) For Work tables, the table name can be prefixed with the name of the application that work_ the table. In
During the naming process, the abbreviations can be pieced together according to semantics. Note that Oracle will unify the field names into uppercase or
One of the lowercase, so you need to underline.
Example:
Definition of abbreviations
Sales:sal sales;
Order:ord orders;
DETAIL:DTL details;
The sales order schedule is named: TB_SAL_ORD_DTL;
2) If the name of a table or field is only one word, it is recommended not to use abbreviations, but to use complete words.
Example:
Definition of abbreviations
Material:ma items;
The Item table is named: tb_material, not tb_ma.
But the field item code is: ma_id; not material_id.
3) All the tables that store the value list are preceded by prefix Z, in order to sort the value list classes at the end of the database.
4) All redundant classes are named (mostly cumulative) preceded by the prefix X
Redundancy class is a field or table that is added to improve database efficiency and non-normalized database
5) The Association class is prefixed with the R by using an underscore to connect two base classes
Name, followed by an alphabetical list of two table names or abbreviations for table names.
Association tables are used to hold many-to-many relationships.
If the table name being associated is greater than 10 letters, the original table name must be abbreviated. If there is no other reason,
Abbreviations are used for recommendations.
Example: Table Object and its own existence many-to-many relationship, then save the many-to-many relationship table named: Tb_r_object;
There are many-to-many relationships between table depart and Employee, and the associated table is named Tb_r_dept_empl.
Field (property, column) naming
1) with meaningful column names, the columns in the table should be designed with a set of rules for the key.
Each table will have an automatic ID as the primary key, and the logical master is defined as the first set of candidate keys, such as
The result is the automatic generation of the database code, the unified name is: ID, if it is a custom logical encoding is abbreviated with "id"
The method name.
Primary key
The primary key is named with the following rules:
The primary key name begins with Pk_, followed by the name of the table that contains the primary key, which is pk_tablename_id. The primary key name cannot exceed 30 characters in length. If it is too long, the table name can be abbreviated. Abbreviated rules for abbreviated rules with table names.
Example: Sales order Number field name: pk_sal_ord_id; If there is also a database-generated auto-numbering,
The name is: ID.
FOREIGN key
The naming of foreign keys takes the following rules:
The foreign key name starts with Fk_, followed by the name of the table with the foreign key and the corresponding primary table name, that is, fk_ from the table name _ Main Table name. The child table name and the parent table name are separated by an underscore "_". The foreign key name cannot exceed 30 characters in length. If it is too long, the table name can be abbreviated. Abbreviated rules for abbreviated rules with table names. Foreign key names are expressed in lowercase English words.
2) database field names are all lowercase English words, between the words with "_" separated,
A naming convention is a table alias + Word.
such as: User_name,user_pwd. (Table alias rule, if the table name is a word, the alias takes the first 4 of the word
If the table name is two words, the first two letters of each of the two words are composed of 4-letter long aliases; if a table
Name consists of 3 words, one from the first two words and then two words from the last word.
The result is a 4-letter long alias. )
Check constraint naming
"Ck_" + "table name" + "_" + "Field name"
e.g.: Ck_tb_company_comp_zip
Default constraint naming
"Df_" + "table name" + "_" + "Field name"
e.g.: Df_tb_news_news_hit
View naming
1) The view name consists of a prefix and an actual name, with an underscore in the middle of the connection. Prefix use
The lowercase letter vi, which represents the view.
The legal view name is similar to the following:
Vi_user
Vi_userinfo
2) naming should reflect the functions of each view as much as possible.
Index naming
Index name = "IDX_" + table abbreviation + related field/index meaning
Index space: Add idx_ before the name of the corresponding data table space. For example, the index space of the user's default tablespace is represented by Ts_idx_default. The index table space for the Code table, expressed in Ts_idx_code.
Stored procedure naming
The stored procedure name consists of the prefix and the actual name plus the operation name, and the middle is underlined.
Prefix: Use the lowercase SP, which represents the stored procedure.
Operation Name: insert| delelte| update| caculate| Confirm
The legal stored procedure name is similar to the following:
Sp_user_insert
function naming
Similar to stored procedures, Fn_user_insert
Sequence naming
The naming of database sequences takes the following rules:
The sequence name begins with Seq_, followed by the field name that uses the sequence. If there are several fields in the same sequence, use the underscore "_" to concatenate the names of several fields. If you want to use a different sequence for the same field name in a different table, add the feature of the table after the field name, using the underscore "_" connection. The sequence name cannot exceed 30 characters in length. The sequence name is expressed in lowercase English words.
Table Space
1: Database system table Space
The database system tablespace includes the system tablespace, the temp table space, and the table space for the rollback segment. Contract the following naming rules:
1) The system table space is directly qualified by the database and cannot be modified.
2) temporary table space is represented by temp. If you have more than one temporary tablespace, start with the 2nd temporary tablespace, and then add a second after temp.
3) The rollback segment table space is represented by Undotbs. If there are multiple rollback segment table spaces, start with the 2nd rollback segment table space, which is appended to the Undotbs.
2: User table space for database
The user table space for the database is represented by the ts_< table space name >. Where the table space name is divided into:
Data space: The default table space for the user, represented by default. For other table spaces, it is represented by the category of the table that is stored on the table space. such as the table of the code, use code to express. The table of customer data, expressed by customers. Try to use a table space to hold the table for that class. If a table is particularly large, consider using a single table space.
Variable name naming
Variable names are lowercase, and if they are in the form of a phrase, separate each word with an underscore, such as @sys_err_no.
Name of the trigger
The trigger is prefixed with TR, the trigger name is the corresponding table name plus the suffix, the Insert trigger is added "_i", and the Delete
Trigger Plus "_d", Update trigger Plus "_u", such as: Tr_customer_i, Tr_customer_d, Tr_customer_u.
Other considerations in naming
1) The above name must not exceed the system limit of 30 characters. Variable name has a length limit of 29 (not including the identity word
Symbol @).
2) The names of the data objects and variables are English characters, and the Chinese names are forbidden. Absolutely not in the object name of the word
Spaces between the characters.
3) Be careful to keep the word, and make sure that your field name does not conflict with reserved words, database systems, or common access methods
4) Maintain the consistency of the field name and type, and be sure to ensure consistency when naming fields and specifying data types for them
Of If the data type is an integer in one table, it will not become a character type in the other table.
5) All tables, fields, stored procedures, etc. must be commented, and the language of the annotation is system-determined.
Programming
Microsoft 3.0 documentation is the main
1. Project Name
"Company Name" + "project actual meaning name"
E.g.:qikingyellowpage
2. Page naming
Rule: Capitalize the first letter of each word because it is a class.
A. Parent page--using nouns to describe
B. Sub-page _ List--"list" + "Parent page"
C. Sub-page _ details--"Show" + "Parent page" "
3. Page Pass Value
"Id_" + "page name"
4. Error page naming
Error.aspx
5. User Login
Userlogin.aspx
6. Folder naming
Capitalize the first letter of the word
Singular or plural, depending on actual needs.
Database Naming conventions