This is the first day of my participation in the More text Challenge. For details, see more text Challenge

preface

In the actual development process, we may be directly oriented to the needs, more is how to achieve the function on the existing basis, thus ignoring the importance of database design. This paper will introduce the specific process of database design, such as ER diagram, database paradigm, etc.

Past the link

  • Brief account main function introduction
  • Brief introduction and deployment of the accounting backend environment
  • Brief introduction and deployment of account front end environment
  • Solve the small program scan code authorization prompt Token cannot be empty

First, the main steps

Generally speaking, database design is divided into the following steps

The conceptual design

define

The goal of conceptual design is to produce a conceptual structure of the database that reflects the information needs of the enterprise organization. The conceptual schema is independent of the logical structure of the Database, independent of the DBMS(Database Management System) that supports the Database, and not dependent on the computer System. ER(Entity relation) model is an abstraction of the real world. Its main components are entities, associations and attributes.

Generally speaking, concept design can be presented well through ER diagram. The ER diagram of role permissions in the profile is as follows:

Two, table design

When it comes to database design, we have to talk about the database paradigm, which generally follows the third Paradigm.

define

1NF First normal form condition: must contain no duplicate group relationships, i.e. each column is an indivisible atomic term. 2NF Second normal form conditions: the relational schema must satisfy the first normal form and all non-primary attributes are completely dependent on the primary code. 3NF third normal form conditions: the relational model satisfies the second normal form, and all non-primary attributes have no transitive dependence on any candidate keyword. That is, each property is directly related to the primary key rather than indirectly

3NF is slightly harder to understand, for example: the record detail table TB_detail table (ID, user ID, cost category name, cost category code, amount) such a table structure does not conform to 3NF. Because the cost category name corresponds to the cost category code, there is a transitive relationship. The correct design should be: TABLE TB_detail (ID, user ID, expense category ID), table TB_SPend_category (ID, expense category name, expense category code)

The design of the database table in the brief account is as follows:

Third, summary

Thank you for seeing the end, it is my great honor to help you ~♥