Light database design (transfer)

zhaozj2021-02-16  75

The importance of database design:

Whether doing what kind of app, the FOR FORM desktop platform application or web application has its obligation rules, which is in the inside, although the implementation details of these business rules are not known for each user. However, this business rule is to be tailored for the user, that is, these business rules are around the user! However, business rules also have their own requirements, and general procedures, or more applications, more applications, have their database participation, and applications are applications to manage data, information collection. Data and information are separated, one is entity, one is the concept of abstraction. However, us more cases are to talk about data information, and the relationship between data and information is very tight. Database as a carrier of data, as information is always reflected, it has an extremely important location in the application, if an application is used as a complete implementation, the database is the application's physical, skeleton, The implementation of the application's specific business rules, and related operations are built around this skeleton! From the implementation of business rules, each business information system has its data model, and the embodiment of the data model is the fine design of the database;

The important location of the database is an important location that anyone cannot deny. A common error is considered: in a lot of applications, there are too many people depend on a DBMS (database management system), however, DBMS is equivalent to any of our application, it is just a platform for us, which provides us with a large platform for "fantasy" space to design, to optimize, to maximize User's business rules come to serve. The design of the database also has the rules of database design, as we often see the first paradigm, second paradigm, third paradigm, or even to the fifth paradigm. These belong to theoretical content, just by applying for a moment, it is impossible to do the fine design of the database. Because each paradigm has its best application, each paradigm has its good application space, and also has its limit. We will not be able to design a database according to some single database style, and this situation does not exist in reality. It is because of the importance of database design, therefore has the proposal of the database design (data mode) idea of ​​an object. It should be pointed out that the database design (data mode) of the object object (data mode) ideology and object-oriented database management system is two completely different concepts (odbms); because the database design thoughts, we will do more, we More more, we can apply database design idea to object-oriented database architectures. (The relational database is non-objective);

How can an application be built for the user? How can an application take the user's business rules? Or an application is on what can make the user's business rules, even complex business rules as possible? The reason is much, but the design of the database is one of the priorities, to some extent, but a weight! Because our database design is established on the business rules already have a certain model, it is served as a business rule, which is a carrier for data, as an expression of information, while the business is not possible to leave the data. information. Thus, the design of the database is a premise of the high efficiency implementation of a good business rule;

In summary, database design is indeed an extremely important status in our application, but how can you design a good database? This requires the design of the square knowledge, only relying in theory will not be able to do a good design of the database in a short time. However, we only need to grasp some key information, put some key ideas, a database design has certain ideas, and our business rules also have a good relying. Specific can be cut in the following points, and then connect our database architecture! 1. Try to eliminate redundancy and uncoordinated dependence:

Database as a carrier for data information, even through an application, we applied the database, which is to hope that it can make reasonable management data, and the unity of the application completes business rules. However, in the implementation of the actual application, we often find that there are many problems, a clear place is to reflect the redundancy of data, and the chaos of various dependence. We make specific descriptions in the form of implementation: OA we often expire as a specific reference example. In OA, the circulation of the official document requires intervention of people with different identities, and it can be parallel and serial traffic. In the same approval process, there may be several people's intervention. Simply put, the traffic of the official document is not separated by the user, then, as a carrier of the data, it is necessary to manage the permissions and perform real-time assignment to different users. This allocation requires a database, how can Do to manage this information about the database? Regular approach is simple, you can make the following settings:

Form 1:

Userinfo (user information table)

Field Format and Rule Description Usercode Char (10) User No. UserName Char (10) User Name UserPass Char (10) User Password UserPop Varchar User Permissions

Form 2:

Userinfo (user information table)

Field Format and Rules Description Usercode Char (10) User No. UserName Char (10) User Name Userpass Char (10) User Password

Userpop (User Rights Form)

Field Format and Rule Description Usercode Char (10) User No. UserPop VarChar User Permissions

We can analyze the above two user privileges, we will definitely, we will maintain some permissions information, and these privilege information will be maintained as follows:

POPTABLE (user permission table) {can also be user duty maintenance table}

Field format and rule description Popcode Char (1) User Permissions No. PopName VARCHAR User Permissions Popy Popy Popy Poplevel INT Priority

Therefore, a complete user rights information maintenance table is constructed by us. Of course, there are some other related conditions related to user rights, however, there is no need to consider so much, we are just a simple application to describe the data redundancy and uncoordinated dependence. For specific problems, it is first necessary to clearly, we can only maintain the maintenance on user rights maintenance, and it is impossible to become a level maintenance! Back to the problem, targeting the form of a metering form and more user choices for formal form, because of the form of a formal form, because we have selected form two, will have two aspects The problem says that our headache, on the one hand, a single form User Rights Form (UserPop) will cost our energy to maintain, and the amount of user permission table data will not be as good as the table information, and we must also It costs three tables, and analysis can be learned. In fact, usercode is a data redundancy, while using a form can be completed to achieve cancer redundancy. However, in the form of two, there is also its availability, we will analyze in detail later. At the same time, because UserCode needs to be indexed to increase the retrieval speed of the database. At this point, we need to consider, efficiency (empty time efficiency, time efficiency). If you have learned a database tutorial, you should know that in any DBMS, maintaining the index fields need to be wasted, or you need to cost these indexes. In the data rules, it is generally maintained by the energy of a index. It is more powerful than the two to three fields to maintain. Therefore, when we have selected the second form, there is no doubt, so that our database system is reasonably Lack. 2. The database is an embodiment of business rules, flexibility is a concept of database.

The database system is a tool, we are not only for us to use our complete data solutions, in which we need to join our own thinking, ideas, so that the business rules can be completely reflected, On the one hand, it reaches a good flexibility, or some changes to us, in order to adapt to the change of the future business rules, therefore, it is necessary to do its scalability when designing the database design, Maintenance, robustness, etc. related characteristics. We still use a briefcase as our design point. For a database design, choose a good entry point. As our reference example, we use user permissions as an entry point, and expand from this entry point. In fact, this choice is not good, but in order to do it, this entry point is selected. With this entry point, we expand. How to raise business rules? When we have a good analysis of business rules, we can continue our database design. The circulation of the official documents, the circulation of the official document is actually the different paths, and each person has a permission assignment, such as browsing, approval, posters, and final collectors. Therefore, it is necessary to associate user rights, jobs and other information. Therefore, in the database, at least a position maintenance is required, and the position is actually associated with permissions. Therefore, we need to re-consider two user information, the options in the permission form, and some changes we need to do. The circular flow is based on the department. Therefore, when we conduct department maintenance, let them associate with the permissions, and different people are different departments, so that the permissions are associated with the department, specific personnel While maintaining the information of the department, it is also necessary to consider a little, the computer is only a hard tool, and its concept is to join it, it cannot be fully reflected by people's thinking. So, we must let it understand our thinking in the best way, or reflect our thinking in a good way, we can design the following department maintenance: DepartmentWh (department maintenance)

Field format and rule description DEPARTMENTID INT department number DepartmentName Char department name departmentfid int parent department number DepartmentPop

Char Department Permission Group Departments

VARCHAR department information

Through the table, we can see that each department has a detailed information on this department, and will include a user rights group. This permission group is divided by group, not just a certain permission, Because, users' permissions are not only for simple permissions, because they are summarized. You can see the following user rights groups:

Popedomwh (department maintenance)

Field format and rule note PopedomID

INT permission number PopeDomname

Char permissions Name Popedomgro

INT

VARCHAR rights information

.........

3. Minimize rules for database

4. Decision of database time efficiency and spatial efficiency

5. The distribution of the database and the application.

6. Good application database management and tools.

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

New Post(0)