Read navigation
Table tables and view views
Stored Procedure stored procedures
TriggerTriggers
IndexIndexes
Primary key primary keys
Foreign key foreign keys
Ults
Column Columns
Script Name
A statement is written ten times, but most of the time it is different. I found some SQL development standard documents online, and wrote some development standard documents about my own SQL based on the project usage.
The decoding standard is a set of writingCode. Coding standards should be flexible enough and will not burden development. As a developer, I personally think that the most important thing to be new to a project is to be familiar with the development standards of the current project. This will not only help you quickly get familiar with existing code and add new code, but also be important for future maintenance.
Table tables and view views
Rule: Use the Pascal naming method and the plural form ending with 'S' or 'els.
Example:
Table: Products, MERS MERs
View: currentproductslists
If a group of related tables is involved, '_' is used '_'
Example:
Products_asia, products_europe
There are still some differences between table and view naming. For example, the table name prefix is 'tb _ 'and 'tbl, use 'vw _ 'as the prefix of the view name.
Stored Procedure stored procedures
Rule: sp <Application name >_[ <group name >_] <behavior> <Table Name/logic instance>. The Pascal naming method is still used for multiple words.
Example:
Sporders_getneworders, spproducts_updateproduct
You can also use 'prc _ 'as the prefix of the stored procedure.
TriggerTriggers
Rule: TR _ <Table Name >_< behavior>
Example:
Tr_orders_updateproducts
Note: triggers are not encouraged.
IndexIndexes
Rule: IX _ <Table Name >_< use '_' to separate multiple columns>
Example:
Ix_products_productid
Primary key primary keys
Rule: pK _ <Table Name>
Example:
Pk_products, pk_orders
Foreign key foreign keys
Rule: FK _ <Table Name 1 >_< table name 2>
Example:
Fk_products_orderss
Ults
Rule: DF _ <Table Name >_< column Name>
Example
Df_products_quantity
Column Columns
Rule: Use the Pascal naming method. If columns in other tables are involved, use the <Table Name> column name.
Example:
MERs table: ID, name
Orders table: ID, customerid
Script Name
Rules:
The Script Name of the stored procedure is prefixed with 'SP _ '.
The Script Name of the schema is prefixed with 'def _ '.
The conversion Script Name is prefixed with 'conv _ '(this concept is not clear yet)
The rollback Script Name is prefixed with 'rbk _ '.
Example:
Sp_getneworders. SQL, def_orders. SQL, conv_orders. SQL, rbk_orders. SQL
General rules
Do not use spaces in naming. Do not use SQL keywords. If you use keywords, place them in '[]' (for example, [year]). we recommend that you use '[]' For All column names.
For naming rules, ifPlease leave a message if you have any additional information.
Naming database development without any conventions is absolute. As long as it is suitable for projects, developers, and accepted by most developers, it is a good standard,