Database Design Guide

xiaoxiao2021-03-06  59

Database Design Guide ------------------ If the company's data is more necessary than life, the database is designed to be the most important part of the application. There are also specialized testers in the materials and sweat recharge, and university degree courses. However, as we have repeatedly emphasized, good teachers are more than experienced teachings. So we have recently found some professionals who have acclaimed database design to teach you some design database skills and experience. Our editor selected 60 of the 60 best skills from 130 feedback, and prepared these techniques into this article. In order to facilitate indexing of its content into 5 parts: Part 1 - Before designing the database Part of the Russen, 12 basic techniques, including naming specifications and clear business needs. Part 2 - Design Database Table Total 24 Guide Tips, covering the design of field design and common problems that should be avoided. Part 3 - How to select the key? Here are 10 techniques to specifically involve the correct usage of the primary key generated by the system, and when and how to index fields to achieve optimal performance. Part 4 - Guaranteed data integrity Discussion How to keep the database clear and robust, how to reduce harmful data to a minimum. Part 5 - Various tips do not include other techniques in the four parts of the above four parts, the five flowers, with them hope that your database development work will be more easily. Page 2 © CNet Networks Inc. 2002www.zdnet.com.cn/developer Part 1 - Before designing the database 1. When you examine an existing environment, you should not only carefully study business needs, but also to examine existing system. Most database projects are not established from the beginning; in general, there is always an existing system used to meet specific needs (possibly automatic calculations). Obviously, existing systems are not perfect, otherwise you don't have to build a new system. But research on the old system allows you to find some subtle problems that may ignore. In general, examining existing systems is absolutely beneficial to you. - Lamont Adams I have taken over a database project developed by regional transportation companies, it is not difficult to use the Access database. I set some project design parameters, and the customer was evaluated with the customer. In advance, the working mode taken in advance. When the final deployment is applied, I only see a few prompts on the terminal and then Rapida is in front of me! I took a toss for my ear for hours, I realized that the two database applications were ran on the network of this company, and access to the network requires clear and strict user accounts and their access. Understand this, the problem is solved: Just use the customer's system. This project gives me the lesson is: Remember, if you develop applications in public environments such as Access or Interbase, be sure to go deep into the system inside the system. What is your facing environment? - kg2. Defining standard object naming specifications must define naming specifications for database objects. For database tables, you have to determine the table name from the beginning of the project to use the plural or singular form. In addition, the alias for the table is a simple rule (for example, if the table name is a word, the alias will take the first 4 letters of the word; if the name is two words, the first two letters of the two words Composition 4 letters long alias; if the name of the table consists of 3 words, you may wish to take one of the first two words and then remove the two letters from the last word, and the result is a different alias, the rest. According to a secondary push), the table name can be added to the prefix Work_ to adopt the name of the application using the table. The columns in the table should use a set of design rules for the keys. For example, if the key is a digital type, you can use _no as a suffix; if it is a character type, you can use the _code suffix.

The column name should adopt a standard prefix and suffix. For another example, if there is a lot of "Money" fields in your table, you may wish to add a _AMT suffix for each column. Also, the date column is best taking DATE_ as a name. - Richard checks the naming specification between the table name, the report name, and the query name. You may soon be confused by the names of these different database elements. If you insist on naming the different components of these databases, at least you should distinguish between these object names with Table, Query or Report et al. - rrydenm If you use Microsoft Access, you can identify objects (such as TBL_EMPLOYEES) with QRY, RPT, TBL, and MOD. I used TBL to independing on the table when I was deal with SQL Server (or Oracle), but I used sp_company (now using sp_feft_) to identify stored procedures, because in some time I found a better handling method often saved Several copies. I identify the function I have written with UDF_ (or similar tags) when implementing SQL Server 2000. - Timothy J. Brucepage 3 © CNET Networks Inc. 2002www.zdnet.com.cn/developer3. In advance, I was still using asset account systems and SYSTEM 38 platforms, then I was responsible for designing all Date field, so you can easily handle 2000 problems in the future. Many people say that I don't want to solve this problem because I have to handle it too much trouble (this is a long time before the Y2K problem in the world). I will say that I will not encounter a big happening as long as I plan to plan. As a result, I only finished the procedure for two weeks. Because of the pre-plan, the Y2K problem has fallen to the lowest level (recently heard that the program is even running on the AS / 400 system in 1995, the unique small problem is from the code to remove the annotation fee from the code Point workfinder). - Generalist4. Get data mode resource manual is seeking sample mode to read the Data Mode Resource Manual, which is written by Len Silverston, Whinmon and Kent Graziano, is a book worth having the best data modeling book. . The book covers a variety of data fields, such as personnel, institutions, and work performance. - Minstrelmike5. Imagine future, but not forgetting the lesson of the past I found that the user seeing the future demand variation is very useful. This can achieve two purposes: First, you can clearly understand which place should be more flexible and how to avoid performance bottlenecks; secondly, you know that users will be as surprised as you when there is no certain demand change in advance. . - chrisdk must remember the lessons of the past! Our developers should also help each other by sharing their experiences and experience. Even if the user thinks they don't need any support, we should also conduct this education in this area, we have all facing this moment "I have to do this." - DHATTREM6. Make logic design before physically practicing to perform logic design before deep physical design. As a large number of CASE tools continue to emerge, your design can also achieve considerable logic level, you can usually better understand the aspects of the database designs. - Chardove7. Understand your business to determine if your system is determined from the customer to meet the needs of your needs before your ER (Entity Relationship) mode (why, you haven't shown it yet? Please see you Skill 9). Understanding your business business can save a lot of time in the future development phase. Once you have identified your business needs, you can make many decisions yourself.

- Rangel Once you think you have clarified your business content, you'd better communicate with our customers. Adopt customer terms and explain to them what you think and you are heard. At the same time, it should also be used, and the system will be used to express the system's relational base. This way you can make your customers correct your own understanding and do the next ER design. - TeburleWPage 4 © CNET Networks Inc. 2002www.zdnet.com.cn/developer8. Creating a Data Dictionary and ER Chart must take a time to create an ER chart and data dictionary. At least at least the data type of each field and the primary keys within each table. It is entirely necessary when creating the ER chart and the data dictionary but it is entirely necessary to understand other developers. The sooner creation can help avoid the possibility of being confusing in the future, so that anyone who knows the database can make data from the database. - BGumbert has a top-new document such as ER chart, which emphasizes it, it is not too much, which is useful to indicate the relationship between the table, and the data dictionary illustrates the use of each field and any other alias. This is exact essential for documentation for SQL expressions. - vanduin.chris.cj9. Creating a pattern is better than a thousand words: developers not only want to read and implement it, but also use it to help themselves and user conversations. The pattern helps improve collaboration efficiency, so it is almost impossible to have a big problem in the initial database design. The pattern doesn't have to be very complicated; it can even be simple to write on a piece of paper. It is only necessary to ensure that the logical relationship on it can produce benefits in the future. - DANA Daigle10. From the input / output to define the database table and field requirements (input), first check the existing or designed reports, queries, and views (output) to determine which of these outputs are necessary. And fields. For a simple example: If the customer needs a report to sort by postal coding, segmentation and summing, you have to ensure that a separate postal coding field is included without using the postal code into the address field. - Peter.Marshall11. Report Tips To understand how users are usually reported: Batch or online submission report? The time interval is daily, weekly, monthly, every quarter or every year? You can also consider creating a summary table if needed. The primary key generated by the system is difficult to manage in the report. The user is retrieved with a sub-key within a table with a system generated primary key, often returns a number of repetitive data. Such retrieval performance is relatively low and it is easy to cause confusion. - KOL12. Understanding customer demand seems to be obvious, but demand is from customers (here you want to consider from internal and external customers). Don't rely on the needs written down, real needs in your head. You have to let customers explain their needs, and as the development continues, it is necessary to ask customers to ensure that their demand is still developed. A unchanging truth is: "Only I saw me know what I want" will cause a lot of rework, because the database does not meet the needs standards that customers have never written. What is even worse is that your explanation of them is only yourself, and it may be completely wrong. - KgilsonPage 5 © CNET Networks Inc. 2002www.zdnet.com.cn/developer Part 2 - Design Tables and Fields 1. Check that all changes I will consider which data fields will change in the future when designing the database. For example, the surname is this (note is the surname of Westerners, such as women who have married after marriage). So, when establishing a system storage customer information, I tend to store the last name field in a separate data table, but also attach the starting day and terminating day, so that this data entry can be tracked.

- Shropshire lad2. With meaningful field name, I have participated in the development of a project. There are programs that have been inherited from other programmers. The programmer likes to display the data indicator to name the field name in the screen, which is not bad, but unfortunate It is, she also likes to use some strange nomenclasses, which naming the combination of Hungarian naming and control serial numbers, such as CBO1, TXT2, TXT2_B, and the like. Unless you are using a system that is only to your abbreviated field name, please clearly describe the fields as well as possible. Of course, don't do your head, such as Customer_Shipping_Address_Street_Line_1 I, although it is clear, no one is willing to type such a long name, the specific scale is in your grasp. - Lamont Adams3. Adopt prefix naming If you have a lot of fields (such as firstname), you may wish to help you identify fields with a particular table prefix (such as cuslastname). - NOTORIOUSDOG timeliness data should include the "Recent Update Date / Time" field. Time markers For the reasons for finding data issues, rescreasting / overloading data by date and clears the old data is particularly useful. - Kol5. Standardization of standardization and data-driven data is not only convenient and convenient for others. For example, if your user interface is to access external data sources (files, XML documents, other databases, etc.), you might as well as store the corresponding connection and path information in the user interface support table. Also, if the user interface performs tasks such as workflow (send mail, print letter, modifying record status, etc.), then data generating workflow can also be stored in the database. The pre-arrangement will always work hard, but if these processes use data drivers rather than hard coding, then strategy changes and maintenance will be much easier. In fact, if the process is data-driven, you can push considerable responsibility to the user, by the user to maintain its workflow process. - TDUVALL6. Standardization can not live for those who are not familiar with standardization (Normalization), standardization can ensure that the fields in the table are the most basic elements, and this measure will help eliminate data redundancy in the database. Standardization has several forms, but Third Normalform (3NF) is often considered to have the best balance in performance, scalability, and data integrity. Simply, 3NF specifies: Page 6 © CNET Networks Inc. 2002www.zdnet.com.cn/developer table can only be expressed once. · Each line in the table should be unique (with unique keys). • Non-bond information dependent on other keys should not be stored within the table. Compliance with 3NF standards has the following features: There is a set of tables that store the associated data connected by the keys. For example, a 3NF database that stores customers and its related orders may have two tables: Customer and Order. The ORDER table does not contain any information for the order related to the customer, but a key value will be stored in the table, which points to the line of the customer information in the Customer table. Higher levels of standardization are also available, but it is better to be better? The answer is not necessarily. In fact, for some projects, even 3nf may introduce too high complexity to the database. - Lamont Adams For the sake of efficiency, it is also necessary to standardize the table, so many examples. There have been a development of financial analysis software to use a non-standardized table to reduce the query time from an average of 40 seconds to two seconds. Although I have to do this, I will never use the non-standardized design concept of the data sheet as the design concept. The specific operation is just a derived. So if you anticipate non-standardized tables, it is entirely possible.

- Epepke7. Microsoft Access Report Skills If you are using Microsoft Access, you can use the name of the user-friendly field name: For example, use Customer Name instead of TXTCNAM. This way, when you create a form and report with a wizard, its name will make people who are not programmers easier to read. - jwoodruf8. Inactive or unused indicators add a field indicating whether the record is no longer active in the business. Whether it is a customer, anyone else is still otherwise, so that it can help to filter active or not active when running inquiry. At the same time, it also eliminates some of the problems faced when using data, for example, some records may no longer be used for them, and then delete it. - Theoden9. Using role entity Definitions belonging to a certain category When you need to define a particular category or a specific role, you can create a specific time-related relationship with a role entity, so you can achieve self-documentation. The meaning here is not to let the Person entity comes with a title field, but said why don't you describe the person with a Person entity and a person_type entity? Then, when John Smith, Engineer is upgraded to Johnsmith, Director and even finally climbed to John Smith, CIO's high, and all you have to do is changing the key value between the two tableson and person_type, while increasing A date / time field to know when the change occurs. In this way, your Person_Type table contains all Person possible types, such as Associate, Engineer, Director, CIO or CEO, etc. There is also an alternative to changing the Person record to reflect changes in the new title, but this cannot track the specific time of the position where you are in place. Page 7 © CNet Networks Inc. 2002www.zdnet.com.cn/developer- Teburlew10. The easiest way to use common entity naming organization data is to adopt common names, such as: Person, Organization, Address, and Phone, etc. When you combine these commonly used general names or create a specific corresponding copile body, you get your own special versions. The main reason for adopting general terms at the beginning is that all specific users can be embodied in abstract things. With these abstract representations, you can use your own special names in the 2nd level, for example, Person may be Employee, Spouse, Patient, Client, Customer, Vendor or Teacher, etc. Similarly, Organization may also be Mycompany, MyDepartment, Competitor, Hospital, Warehouse, Government, etc. Final Address can be specifically Site, Location, Home, Work, Client, Vendor, Corporate, and FieldOffice. Using general abstract terms to identify "things" categories allow you to achieve huge flexibility in association with business requirements, while doing so can significantly reduce the redundancy required for data storage. - Teburlew11. When designing a database in the world is designed to a network or other international characteristics, it is necessary to remember that most countries have different field formats, such as postal coding, etc., some countries, such as New Zealand, there is no postal code. Say. - BILLH12. Data Repeat requires the discrete data sheet if you find yourself in repeated input data, please create a new table and new relationship.

- Alan Rash13. 3 useful fields · DRECORDCREATIONDATE you should add in each table, default is now (), and getDDATE () · SRecordcreator under SQL Server, under SQL Server, NOT NULL DEFAULT USER · NRECORDVERSION, recorded version tags; helps to accurately describe NULL data or loss data in records - Peter Ritchie14. It is not enough to use multiple fields to use multiple fields for addresses and phones. Address_Line1, address_line2 and address_line3 can provide greater flexibility. Also, the phone number and email address are best to have its own data sheet, and it has its own type and tag category. - DWNERD Over-standardization can be careful, doing so may result in problems in performance. Although address and telephone tables can usually reach the best, if you need to access such information frequently, you may be more appropriate to store "preferred" information (such as Customer et al.) In its parent table. Compromise between non-standardized and accelerated access is certain. - Dhattrempage 8 © CNET Networks Inc. 2002www.zdnet.com.cn/developer15. I feel very surprised to use multiple names fields, and many people leave a field in the database. I think that only developers who have just been introduced will do this, but this practice is actually very common online. I suggest that the last name and name are treated as two fields, and then combine them again when querying. - Klempanklempan is not the only person noticed to use a single Name field to make this situation more friendly to users. I am most commonly created in the same table, which can be used automatically by automatically connecting the standardized field so that it will change when data changes. However, doing so when using modeling software. In summary, use the connection field to effectively isolate the user application and developer interface. - Damon16. Bewix the size of the object name and special characters in the past, one of the most annoyed things in the past is the object name in the database, such as CustomerData. This problem exists from Access to the Oracle database. I don't like to use this case-sensitive object naming method, and the result has to be manually modified. Think about it, can this database / application not to use a more powerful database? All uppercases and the names containing the names of the underwriting have better readability (Customer_Data), absolutely don't leave space between characters of the object name. - BFREN17. Be careful to keep your field name without a retention word, database system or common access method conflict, for example, there is a table in an ODBC connection program I have written, where DESC is used as a description field name. The consequences can imagine! DESC is the reserved word after the abbreviation of Descending. A SELECT * statement in the table is available, but I get it is a lot of information that is useless. - Daniel Jordan18. Keep the field name and type consistency must guarantee consistency when named the field and specify the data type. If the field is called "agreement_number" in a table, you don't change the name to "REF1" in another table. If the data type is an integer in a table, you can turn it in another table. Remember, you have done your own lives, others have to use your database.

- setanta19. Carefully select Digital Types Use Smallint and Tinyint type in SQL to be particularly careful, for example, if you want to see the total monthly sales, your total field type is smallint, then if the total amount exceeds $ 32,767 You can't calculate Operate. - Egermain20. Deleting tag contains a "Delete Tag" field in the table so that the row is marked as deletion. Do not delete a row separately in the relational database; it is best to use clear data programs and carefully maintain index integral. - Kolpage 9 © CNET Networks Inc. 2002www.zdnet.com.cn/developer21. Avoid using trigger triggers can usually be implemented in other ways. The trigger may become interference when debugging the program. If you really need a trigger, you'd better focus on its documentation. - KOL22. Contains version mechanism recommends that you introduce version control mechanisms in the database to determine the version of the database in use. This requires this requirement anyway. For a long time, the needs of users will always change. It may eventually be required to modify the database structure. Although you can determine the version of the database structure by checking new fields or claims, I found that the version information is not more convenient in the database? . - Richard Foster23. For text fields, pay the balance ID type text field, such as customer ID or order number, etc. should be set to be bigger than the general imagination, because time is not long, you will have additional characters It is unpleasant. For example, suppose your customer ID is 10 digits. Then you should set the length of the database table field to 12 or 13 characters. Is this a waste of space? There is a little, but there is so much that you imagine: A field extends 3 characters in 1 million records, plus a little index, but the entire database is more than 3MB of space. But this additional space can achieve the growth of database size without the need to refactor the entire database in the future. - TLUNDIN24. Column name tips We found that if you give a unified prefix if you give each table, you will be greatly simplified when writing SQL expressions. This does have something disadvantaged, such as destroying the role of the automatic table connection tool, the latter links the public column name to some databases, but even these tools sometimes do not connect to errors. For a simple example, assume that there are two tables: Customer and Order. The prefix of the Customer table is CU_, so the subparaminated in the table is as follows: Cu_name_ID, Cu_Initials, and Cu_Address, etc. The prefix of the ORDER table is OR_, so the subparade name is: or_order_id, or_cust_name_id, or_quantity, and or_description, etc. So the SQL statement that is selected from the database can be written as follows: SELECT * from customer, Orderwhere Cu_Surname = "MyName" and co_name_id = or_cust_name_idand or_quantity = 1; Write this in the case where the prefix is ​​not: SELECT * From customer, Orderwhere Customer.Surname = "MyName" and customer.name_id = Order.cust_name_idand ORDER.QUANTITY = 1 The first SQL statement is not type how much characters. But if the query involves 5 tables or more columns, you know how much this skill is used.

- Bryce Stenbergpage 10 © CNET NetWorks Inc. 2002www.zdnet.com.cn/developer Part 3 - Select button and index 1. Data mining should pre-plan my market sector to deal with more than 80,000 contact information, fill in The necessary data for each customer (this is definitely not small). I have to identify a group of customers as a market goal. When I started the design table and field, I tried to add too many fields in the main index to speed up the running speed of the database. Then I realize that specific group queries and information mining are neither accurate speed. The results have to rebuild in the main index and incorporate data fields. I found that there is a key to the key - when I want to create a system type lookup, why should I use a number as the main index field? I can retrieve it with a fax number, but it is not important to me like the system type. Using the latter as the primary field, re-indexing and retrieval after the database is updated. - HSCOVELL Operation Data Warehouse (ODS) and Data Warehouse (DW) The data index in both environments is different. In the DW environment, you have to consider how the sales department organizes sales activities. They are not database administrators, but they determine the key information in the table. The designer or database staff should analyze the database structure to determine the best conditions between performance and correct output. - Teburlew2. Use the system generated primary key this day class with skill 1, but I think it is necessary to repeat everyone here. If you always use the system generated key as the primary key when you design the database, you actually control the index integrity of the database. In this way, the database and non-manual mechanisms effectively control the access to each line of storage data. It is also advantageous to use the system generated key as the primary key: When you have a consistent key structure, it is easy to find logical defects. - Teburlew3. Decomposition fields are used to index in order to separate naming fields and include a field to support user-defined reports, consider decomposing other fields (or even primary keys) for their constituent elements so that users can index them. The index will speed up the execution speed of SQL and report generator scripts. For example, I usually create a report if you have to use the SQL Like expression, because the Case Number field cannot be broken down into such elements such as Year, Serial Number, Case Type, and Defendant Code. Performance will also become. If the annual and type fields can be broken down into index fields, then these reports will run more. - RDELVAL4. Key Design 4 Principles · Create foreign keys for related fields. · All keys must be unique. · Avoid using a compound key. · Foreign key is always associated with unique key fields. - Peter Ritchie 11 © CNET Networks Inc. 2002www.zdnet.com.cn/developer5. Don't forget that the index index is one of the most efficient ways of getting data in the database. 95% of database performance issues can be resolved using indexing techniques. As a rule, I usually use a unique group index for the logical primary key, using a unique non-group index for the system key (as the stored procedure), and uses a non-group index for any foreign key column. However, the index is like a salt, too much vegetables are 篌. Do you have to consider how big the database is space, how to access, and whether these accesss are mainly used as read and write. - TDUVALL Most databases index auto-created primary key fields, but don't forget the index foreign key, they are also used frequently, such as running a query showing a record of the primary table and all associated tables. Also, don't index the Memo / Note field, don't index large fields (there are a lot of characters), so that the index will take much storage space. - GBRAYTON6. Do not index common small tables Do not set any keys for small data tables, if they often have such a insertion and deletion, don't do this. Index maintenance for these insertions and deletions may consume more time than scanning tables.

- kbpatel7. Do not use SSN to use SSN as a database of the database. In addition to privacy reasons, it is important to know that the Government is increasingly tending to use SSN as other purposes other than income, and SSN needs manual input. Never use the manual input key as the primary key, because once you enter an error, you can do it is to delete the entire record and start from the beginning. - Teburlew I was still studying at the 1970s, I remember that SSN has been used to be used, of course, although it is illegal. And people also know that this is illegal, but they are used to it. Later, with the increase of stealing cases, my current university campus is painfully deleted from a large stall data. - generalist8. Do not use the user's key to determine what field as the key to the table, you must be careful that the user will be edited. In general, do not select the user-edit field as a key. Doing so will force you to take the following two measures: • Application of the behavior of the user editing field after creating a record. If you do this, you may find that your application suddenly changes in business needs, and users need to edit those informable fields lack sufficient flexibility. What do they think so when the user finds the system after entering the data until the record is saved? Delete rebuild? If the record cannot be rebuilt? · Propose some methods for detecting and correcting key conflicts. Usually, the cost of payment is done, but from the performance of the performance, it is relatively large. Also, the correction of the key may force you to break through your data and the isolation between the commercial / user interface. So still override an old saying: your design should adapt to the user rather than letting users adapt to your design. - Lamont ADAMS does not allow the primary key with updateability, in which the primary key implements the association between different tables. For example, the Customer Table has a primary key Customerid, while the customer's order is stored in another table. The primary key for the Order table may be possible. No matter which key settings you choose, you need to store Customerid in the Order table to ensure that you can find its order records for users. If you modify CustomerID in the Customer table, you must find all relevant records in the Order table to modify it. Otherwise, some orders will not belong to any customer - the integrity of the database is finished. If the index integrity rule is applied to the table level, it is almost impossible to change the records of a record and all associated records in the database without writing a large number of code and additional deletion records. And this process is often incorrect, so it should be avoided as much as possible. - ljboast9. Optional button Sometimes you can do the primary key to remember, querying the data is not a machine but people. If you have an optional button, you may further use it for primary key. In that case, you have the ability to build powerful indexes. This prevents those who use the database from connecting to the database to properly filter data. This load is more awake on the database of strict control domain tables. If the option is really useful, it is the level of the primary key. My opinion is that if you have optional keys, such as State_code in the country, you don't create subsequent keys on the unique key of the existing unable to change. You have to do more than creating a worthless data.

For example, the following example: Select count (*) from address, state_refwhereaddress.state_id = state_ref.state_idand state_ref.state_code = 'TN' My approach is this: Select count (*) from addresswhereand state_code = 'TN' As you because of excessive Use the following subsequent keys to establish this association, and the operation load is really needed. - Stocker10. Don't forget that the main key fields of the foreign database index are created. But don't forget the index outer key field, they will be used each time when you want to query the record and its associated records. Also, don't index the Memo / Notes field and don't index large text fields (many characters), which will make your index occupy a lot of database space. . - GBRAYTONPAGE 13 © CNET NetWorks Inc. 2002www.zdnet.com.cn/developer Part 4 - Guaranteed Data Integrity 1. Forced Data Integrity with Constrained Not Business Rules If you handle requirements according to business rules, then you should Check if the business level / user interface: If the business rules have changed, it is only necessary to update. If the demand stems from the need for maintenance data integrity, it is necessary to apply a restriction condition on the database level. If you really use constraints in the data layer, you have to guarantee that there is a way to notify the user interface using the user's understanding of the language that cannot be understood by the cause of constraints. Unless your field name is very lengthy, the field name is not enough. - Lamont Adams As long as it is possible, please use the database system to implement data integrity. This includes not only the integrity of standardization and also includes functionality of data. You can also increase the trigger to ensure the correctness of the data when writing data. Do not rely on the business layer to ensure data integrity; it does not guarantee the integrity of the table (foreign bond), so it is impossible to impose on other integrity rules. - Peter Ritchie2. Distributed Data System For distributed systems, you should estimate the amount of data in the next 5 or 10 years before you decide whether all data is replicated in each site. When you transfer the data to other sites, it is best to set some tags in the Database field. New your tags after you receive your data at the destination site. To make this data transmission, write down your own batch or scheduler running at a specific time interval without transferring data after every day. Local copy your maintenance data, such as calculation constant and interest rate, etc., setting the version number to ensure that data is exactly the same at each site. - Suhair TechRepublic3. Forced instruction integrity No good way to eliminate it after harmful data into the database, you should remove it before it enters the database. Activate the integrity features of the database system. This allows the data to be cleaned to force the developer to put more time handling error conditions. - KOL4. Relationship If there is a multi-pair relationship between the two entities, it is also possible to translate into a multi-relationship, then you'd better set up to multiple relationships at the beginning. From the existing multi-to-one, there are many more relationships than a lot of relationships than one. - CS Data Architect5. Adopt view In order to provide another layer of abstraction between your database and your application code, you can establish a special view for your application without having to access the data table directly. This is also equal to providing more freedom when processing database changes. - Gay Howepage 14 © CNET Networks Inc. 2002www.zdnet.com.cn/developer6. Give Data Supply and Recovery Develop Plan Consideration Data Support Policy and is included in the design process, pre-design your data recovery process. It is possible to ensure that data identification of data dictionary to the user / developer can also ensure documentation on data source. Write an online update to "Update Query" for later data loss can be re-process updates.

- KOL7. The storage process allows the system to resolve many troubles to generate a highly integrity database solution, my team decides to package some of the functional groups of associated tables, provide a set of regular stored procedures to access each Group in order to speed up the speed and simplify the development of customer program code. During this time, we found that the 3GL encoder sets all possible error conditions, such as the following: SELECT CNT = Count (*) from [

] Where [] = if CNT = 0BEGININSERT INTO [
]) Values ​​() EndelseBegin End and a non-3GL encoder is doing this: Insert Into [
] []) Values ​​() if @@ Error = 2627 - Literal Error Code for primary key constraintbegin End 2nd program is simple, and in fact, use We give the database function. Although I personally don't like to use embedded text (2627). But it can be used in a pre-processed pre-treatment. Database is not just a place where data is stored, it also simplifies the encoding. - A-smith8. The best way to find the integrity of the control data is to limit the user's choice. As long as it is possible to provide a clear value list for users to choose from. This will reduce the incorrect and mishand of the type of code to provide data consistency. Some public data is especially suitable for finding: national code, status code, etc. - CS Data ArchitectPage 15 © CNET Networks Inc. 2002www.zdnet.com.cn/developer Part 5 - Various tips 1. Document, document, documentation to all shortcuts, naming norms, limitations, and functions . - NickypendRagon uses a database tool that is given to the table, column, trigger, etc. Yes, this is a little effort, but in the long run, this is very useful for development, support, and tracking modifications. - Chardove depends on the database system you use, there may be some software to give you a document for you to get started. You may wish to start now, then get more and more details. Or you may want a periodic pre-arrangement, in the input of new data, along with your progress to every part of each part. No matter which way you choose, you will always be able to document your database or create a document inside the database itself. In this way, when you have been going over more than a year, I will return to the second version, and the opportunity you make mistakes will greatly decrease. - MRS_HELM2. Using common English (or any other language) instead of why we often use coding (such as 9935A may be the supply code of the ink pen, 4xF788-q may be an account code)? Reason a lot. But users usually think in English rather than coding. Accounting for 5 years may know what 4xF788-q is, but new can not be. It is best to sort in English name when creating a drop-down menu, a list. If you need to be encoded, then you can attach the user knows English. - AMASA3. Save common information to make a table to store general database information is very useful. I often store the current version of the database in this table, recently check / fix (for Access), the name of the design document, customers, etc.

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

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.057, SQL: 9