Determination and Conversion of Ternary Contact Types in MySQL Learning


Foreword Preface:


In the process of reviewing database principles today, I reviewed the determination and conversion of multiple contact types in database principles. I was a little confused for a while. I gave an example in the book (contact type conversion of 1:M:N with description attributes) , and then my question comes: (How do we convert the ternary relationship 1:M:N that does not describe attributes? What about the converted relationship type?) The teacher also basically mentioned in class. I took it for a while, and then I took it. I was very distressed for a while, and I didn’t know what to do. Then I searched and learned a lot on the Internet. I know one or two of them. I will share with you the diversity here. Ternary Contact in Contact ...


text:


1. Determination of the type of contact (ternary contact)


Four contact types:


1,1:1:1
2,1:1:N
3,1:M:N
4,M:N:P


(1), 1:1:1 contact

write picture description here
Contact Analysis:

  • A technician uses a manual for a project
  • Each manual is used by one technician per project
  • Only one manual can be used by one technician on a project

(2), 1:1:N contact

write picture description here
Contact Analysis:

  • A project can only be executed in a specific location and can be assigned to multiple employees to complete
  • An employee can only work on one project at a given location
  • A project can be completed by multiple employees at a given location

(3), 1:M:N contact

write picture description here
Contact Analysis:

  • One engineer managed by one manager can be involved in multiple projects
  • Multiple engineers involved in a project managed by a manager
  • An engineer working on a project can only have one manager

(4), M:N:P contact

write picture description here
Contact Analysis:

  • An employee is able to use multiple skills in one project
  • One employee's skill can be used in multiple projects
  • A skill can be used by multiple employees in a project

(5), summary

Summary: The analysis starts from the perspective of each entity, looks at the other two entities, and analyzes according to the type relationship of the connection. When the business process analysis is clear, the conceptual design, ER diagram and database table design are also very clear. is presented!


2. Conversion of contact types (ternary contact)

In addition to determining its relationship, another point is how to convert the ER model relationship obtained above into the form of a relationship table.


1:1:1 Contact Conversion

If the relationship between entities is 1:1:1. The attributes of any one of the three relational schemas converted from the three entity types can be converted into the attributes of the primary key (as a foreign key) and the relation type of the other two relational schemas.


Conversion of 1:1:N Contacts

If the relationship between entities is 1:1:N. Then, in the relationship schema converted from the N-end entity type, the primary key (as a foreign key) of the two 1-end entity types and the attributes of the contact type are added or subtracted.


1:M:N Contact Conversion

If the relationship between entities is 1:M:N. Then the contact type is also converted into a relational schema, (its attributes are the primary key (as a foreign key) of the M-side and N-side entity types plus the attributes of the contact type.) The primary key is the combination of the M-side and N-side entity primary keys.


Conversion of M:N:P Contacts

If the connection between entities is M:N:P. Then the contact type is also converted into a relational schema, and its attributes are the primary key of the three-terminal entity type (as a foreign key) plus the attributes of the contact type. The primary key is the combination of the primary keys of the three-terminal entity.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324651716&siteId=291194637