Based on years of design experience, I have summarized some application system design routines and discussed them with you. It is relatively simple, just throwing them into the database part: each time a new system comes in, after finishing the requirements, we always need to design databases and design table structures according to business needs. If we do not follow these sets, the system will always implement and maintain them, the three paradigms in the teaching material are comparatively abstract. I have summarized these three years and thought that the database design involves the following two types: maintenance and application.
MaintenanceThere are 3 types
Code tableHard-coded tables in the program. Generally, enumeration can be defined in the program to replace the common design with the ID, code, and name fields, these tables cannot be cleared during system initialization.
Base tableBasic information in a system, such as employees, departments, and departments, also needs to be classified. the common design is two tables. Table 1 is an entity table, and the required fields are ID, encoding code, name, remarks, and deletion mark. Table 2 is a classification table, the function is to classify an object table. The fields include ID, upper-level encoding, whether the last level, and name. The two tables are associated by the category of table 1 and the ID of table 2. the most typical application of basic tables is the design of Department tables. A Department is a tree structure. When designing a table structure, Newbie always designs a table, which brings many problems, designed according to the basic table mode, you can avoid
Relational tableCombine two basic tables. The fields include ID, base table 1 primary key ID, and base table 2 primary key ID. A typical application is to save the relationship between employees and departments. Instead of adding a department to the employee table for association, a department relationship comparison table is designed separately.
Application tableThere are two major types, namely the familiar Master/Slave detail table types.
Master tableDesigned as needed. In addition to business information, the fields required for such tables also need to be reviewed for the logo, operator, reviewer, operation time, and business process control fields.
Slave tableStore the detailed business information of the master table and associate it with the ID of the master table, A master table record is often associated with multiple slave table records. A typical application of the application table is to save various documents in the management system concerning the ID design, there are two options: the first is the self-increasing ID, and the second is the guid type (recommended during distributed development). When designing a database for an application system, we strongly recommend that you first create a conceptual model. Most of the tables can follow the type summarized above to design the table design normalization. The biggest benefit is that in the Development Program, for these five types, with Object Persistence technology, you can develop common program templates to improve development efficiency.
I will also sum up my experience after the opportunity to discuss the relationship between table design and Object design.