Many-to-many mode is also a common database design pattern. The two objects described in this pattern are in a one-to-many relationship, regardless of their primary and secondary nodes, and their status is equal to each other. For Table A, a record corresponds to multiple records of Table B. For Table B, a record corresponds to multiple records of Table, this is "Multi-to-multi-mode ". "Multi-to-multi-mode" requires an associated table between table A and Table B, which is also the core of "Multi-to-multi-mode. Based on whether the associated table has independent business processing requirements, it can be divided into two subdivisions. 1. Associated tables have independent business processing requirements. The following is an example (Note: This example has been simplified to a considerable extent. It is only used to help you understand the concept of "many-to-many". Please note that ). For example, online bookstores usually have "bibliography information" and "wholesale orders ". A "bibliography information" may have multiple "wholesale orders" for different buyers. In turn, a "wholesale ticket" can also be used to wholesale multiple books, which is multi-to-multi-mode. The "wholesale order details" table in the middle is an associated table of the two. It has independent business processing requirements and is a business entity object. Therefore, it has some unique attributes, for example, for each detailed record, "cumulative return Times", "cumulative return quantity", "cumulative settlement Times", and "cumulative settlement quantity "; since the details of the wholesale order have been printed out in a paper list for the customer after the data is generated, therefore, the bibliography attributes printed in the paper list are redundant (inverse Standardization) in the "wholesale order details" table. In this way, even if the attributes in the "bibliography information" table are modified in the future, it also does not affect checking the details of the wholesale ticket with the customer, and will not affect the future financial settlement business. 2. The associated tables do not have independent business processing requirements (Note: This example has been simplified to a considerable extent and is only used to help you understand the concept of "many-to-many, please note ). For example, the relationship between a user and a role is generally used by the system for permission control. Program"System User table" and "system role table" are involved ". A user can belong to multiple roles. In turn, a role can contain multiple users. The two are also typical "many-to-many relationships ". In most cases, the Association Table "User Role Association Table" is used only to indicate the association between users and roles, and does not have independent business processing requirements, therefore, there are no special attributes.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service