Database table design issues (notes)

notes

1. You can add corresponding sub-table fields to the main table, making it easier to query the
existing main table information table and audit table. The information can be reviewed step by step, with the first-level unit reviewing and then the second-level unit reviewing, and finally changing the information table. The status and table structure are as shown in the figure below:
Insert image description here
In this case, the query paging requires a left link between the information table and the audit table. Because it is a one-to-many relationship, the query data needs to be filtered, sorted in reverse order, and select audit The latest piece of data in the table, this operation is more troublesome, and the database statements are more redundant.
Insert image description here
You can add fields such as the ID of the audit table and the current audit agency to the main table to store the current audit information. In this case, each audit is performed , you need to update the main table, update the latest audit information in the main table, you can directly find the current audit information when querying, you can directly find the only corresponding audit information when making a left connection, or directly display the main The audit information stored in the table is more convenient and faster.

Guess you like

Origin blog.csdn.net/mcband/article/details/128091845