Frog Frog Recommended: SQL Related Coding Specification.doc

xiaoxiao2021-03-06  68

1. Try to use the coding table;

2. There is a single nature record form to establish a primary key index;

3. The properties data designed to be described in the same object is in the same table;

4. There is a detailed detailed description, to build a sub-table;

5. To improve the query speed, establish the necessary index;

6. To prevent unreasonable data in the database table, establish the necessary constraints and default;

7. Delivery characters use char, nchar type; uncertainty using VARCHAR, NVARCHAR;

8. Date time is best to use the DateTime type, easy to compare and calculate.

9. In order to save space, minus data redundancy; in order to increase processing speed, data redundancy can be appropriately added. The balance of the two must be mastered.

10. Try to place the current active data in different tables with historical precipitation data. Search by establishing a view. To improve the processing speed of activity data.

Add a little, I appreciate the naming regulatory namings recommended by the front SKY_BLUE (old), but at the same time, due to the presentation of Stored Procedure's named prefixed prefix 'SP_', there is also the SP_ 'started in the master table. Procedure, I saw on a professional SQL Server book, the author recommended using 'up_' means User Procedure, I used to use sp_ named my own storedure but now in order to standardize, or change to UP_, of course, personal You can use yourself to name your prefix. However, since it is necessary to take a regulatory programming road, it is best to avoid definition of the names that make it easy to confuse others.

In addition, the Chinese named database object includes friends in other program languages, I said that SB may be serious. I am not a good authority, I can't give Chinese names, there is any drawback, but the world The programmer has a custom into the world of e-text as a standard program language, do not put the so-called "Chinese characteristic" logic into the program design.

Personally, if there is no shortcomings in using Chinese naming, you should go to the filter naming method from the convenience of the problem. Why must be stamped in a so-called standard, the standard is a foreign man, it is definitely based on English, Who taught us to use E text, book, book, and the foreigner wrote, of course, E-article standard.

Our purpose is to easily solve the problem easily. The entire system is applied in the Chinese environment, the library structure is very clear, no need to turn over the documentation. And sometimes the document does not necessarily explain the problem. Moreover, Chinese NT2000 and SQL2000 kernel Use and allow Chinese.

I use E text as the following question:

1 is faulty. Look at a SQL statement, don't know what it is doing.

2 The expression is unclear. If you make a detriments and field name in English words, unless all programmers are English masters, they can understand the terms in all industries, otherwise they may have to turn the Dictionary.

3 Name it according to a certain rule, renowned more. Many people use Pinyin ablation, but if there is similar or similar pinyin, they will be unclear, and the pinyin is sometimes not always read.

So, what simple things are not to do, don't have to make a complicated are called "standard"?

It is best not to name Chinese. After the language environment changes, it will encounter problems. It is very likely to be garbled. E text will not have problems, why don't we consider far, can't bury these? Hidden danger

To stwx ()

(You don't have to pass through the document ..) Horror, there is such a development!

(Except for transplants ..) I don't know how to except this important situation!

Moreover, check the dictionary multidemption words are not bad.

in case:

IF .... THEN .....

become

If .... then ..... What do you think?

The best is to establish a crosk, establish a set of specifications, a good set of norms can absolutely solve your 3 problems

Doing the program is not painting, some things must be in accordance with the specification.

Come on a project, there are minimal dozens of data tables, so many fields, do you have any fields? You can determine what the SQL statement knows what it is doing! Using Chinese, Don't drill the horn tip, which is convenient, readable! If you think that E text is more convenient, read more, just like if..then, don't stick to what type, or not too pedigit! Regarding the transplant, it is not important, which is the project used environment. At least, I haven't done the products to sell throughout the world. Since it is the domestic application, just make sure there is no problem in the Simplified Chinese environment.

Try, now who use E text NT2000 or SQL2000 to develop Chinese products, so very few things!

We are defined like this

Table xxxx_xxxxxxx_x

The top three is the system code, such as the CIS GIS represents different applications.

The fourth is C, M, and H c represents the code maintenance table is usually single table, m represents a more important table, H represents a history record table.

The intermediate section is a table description

The last bit is H d r, h represents the primary table of the main slave table, and D represents the slave table of the main slave table, R indicates the contact list.

The benefits of this design, focus on development, is named to programmakers, see which template is used to develop. Therefore, it can improve the development speed, and the practice prove is really a lot! For reference

Talk about my usual rules.

Table name I never add T or TBL prefix

I remember that some people have said it, if you have hundreds of tables

You will know the pain of this name.

I usually add function prefix, such as BAS_CUSTOMERS PUR_VOUCH

View, in order to distinguish the table, add the VW_ prefix, the main related table name, then bring the function

Stored procedure, plus PC_ prefix, SP Since the system will look for the Master library first, it is not recommended.

Trigger, TG_ table name _ function

Field name, I still like type, short-write table, simplification field meaning,

Such as ccuscode - customer code, VARCHAR type

Specific SQL statement, all keywords, except for Declare and data types

Where the table name, all of the Chinese Pinyin head abbreviations English table names.

The reason is that at least others can check, you can understand

You mean. Chinese characters are because of simple, generally two letters.

Such as Zy hospital MZ clinic. One company should be compared to the module

clearly.

Such as:

ZY_PATIENT hospitalized

Doing so, the data tables of the same module are arranged together.

Global table,

A_User

Thus, the global table is arranged in front.

Global Dictionary

ZD_COUNTRY National Dictionary Table

The field name is in English,

You can use abbreviations, if there is a general purpose, use universal abbreviations, if not,

Then remove the vowel letters. Strictly prohibit other forms of creation.

In addition to the industry regulations, there is no Chinese Pinyin head and Chinese. The reason is as above.

but

The JY_WTK securities industry represents the deduction of the transaction module.

It is strictly forbidden to use the type of prefix like Nyear. Because Hungarian nomenclature is all meaningless in the SQL statement.

Microsoft is not recommended to use this solution.

Among them, the primary key will be used in id. There are also people recommending the name_ID. Both are almost.

Some software back automatically connects primary keys and foreign keys when using the latter.

The field of the dictionary is all

CODE code

Name name

PY_CODE Pinya

WB_CODE five password

This is to implement a dictionary maintenance program and input

Automatic pop-up of the dictionary in the interface

The stored procedure starts with UP, and the original Microsoft starts with SP.

Later, M $ monette this word.

The rest is like someone else, everyone is almost.

转载请注明原文地址:https://www.9cbs.com/read-91514.html

New Post(0)