Introduction to the foreign key of the primary key-the parent table sub-table re-recognizing the concept of a contact information classification example: User's contact information 1 user's target object (receiver) contact Information 2 manufacturer's contact information 1 dealer's contact information 1 dealer's shop Contact Information 2 is available from the above information, the contact information requirements are divided into two categories: contact information that is in one-to-one relationship with the business entity
Introduction to the foreign key of the primary key-the parent table sub-table re-recognizing the concept of a contact information classification example: User's contact information 1 user's target object (receiver) contact Information 2 manufacturer's contact information 1 dealer's contact information 1 dealer's shop Contact Information 2 is available from the above information, the contact information requirements are divided into two categories: contact information that is in one-to-one relationship with the business entity
Introduction
Foreign key of primary key-recognition of parent table sub-table
A classification example of the concept of contact information:
• User Contact Information 1
• Contact Information of the user's target object (receiver) 2
• Manufacturer's contact information 1
• Dealer Contact Information 1
• Dealer store Contact Information 2
The above information is available, and the contact information requirements are divided into two categories:
- In a one-to-one relationship with the business entity, key relationships other than the contact information ID are placed in the business object. Such as user, manufacturer, and dealer information;
- The user, manufacturer, dealer, and other business objects need to have multiple contact information related to their business. The contact information of the user's receiver and the store of the seller.
Analysis
My contact information is my personal property. Is it my "parent "? Right?
Obviously, the concept of parent-child relationship in a relational database is different from that in OO.
Interestingly, relational databases focus on the horizontal "Relationships" between objects, with almost no vertical relationships. OO, on the contrary, inheritance polymorphism is the expression of vertical relationships. Of course, horizontal relationships can also be expressed as though they are not quite natural.
Therefore, the "Parent and Child" of a relational database is not equal to the "Parent and Child" of OO ".
The parent of a horizontal "relationship" is a more basic element. The smaller the granularity of the element, the longer the element ". The relational coefficient is one, with only the primary key;
The child of the horizontal "relationship" is a quadratic element, which contains components of the parent element. The relationship coefficient is multiple. There must be a foreign key.