3.4.2 Database system - logical structure design: logical structure design process, relational mode conversion

3.4.2 Database system - logical structure design: logical structure design process, relational mode conversion

Logical Structure Design Process

Please add a picture description
Conversion of ER diagram to relational schema:

  • Entity to Relational Model Conversion
  • Conversion of relational to relational schemas

Generalization of relational schema:
I will talk about this later, there are more contents

Determination of integrity constraints (ensure data correctness)
determination of user attempts (increase data security and independence):

  • Determine the view used by the process from the data flow diagram
  • Determine which views are used by different users based on user category

application design

Relational Schema Transformation

An entity type must be converted into a relationship mode.
The relationship mode is divided into two types:
there are two ways to convert a one-to-one relationship:
① Independent relationship mode: incorporate the primary key at both ends and the properties of the relationship itself. (Primary key: primary key at either end)
②Merge (at either end): Merge into the primary key at the other end and contact its own attributes. (primary key: remain unchanged)

There are two ways to convert a one-to-many relationship:
①Independent relationship mode: incorporate the primary keys at both ends and the attributes of the relationship itself. (Primary key: multi-terminal primary key)
②Merge (multi-terminal): Merge into the primary key of the other end and contact its own attributes. (primary key: remain unchanged)

There is only one way to convert a many-to-many relationship:
an independent relationship model: incorporate the primary keys at both ends and the attributes of the relationship itself. (Primary key: composite key of primary keys at both ends)

contact type Entity
(independent relational schema)
Contact
(independent relational schema)
Contact
(Merge Relationship Schema)
Remark
1 to 1 merge into either end
1 to many Incorporate into multi-terminal
many to many ×

For example, the following question:
In the design of the logical structure of the database, the conversion of the ER model into a relational model should follow the relevant principles. For the many-to-many relationship m:n:p between three different entity sets, at least (4) relationship modes can be converted.Please add a picture description

As an entity type, ABC must be converted to an independent relational schema, so there are 3 relational schemas here

Looking at the contact mode again, the three are directly many-to-many, so the relationship mode cannot be merged, and only three of them share one relationship in the figure, so the contact mode is converted into one relationship mode. ABC will not be considered separately, because the connection has been abstracted, and ABC is connected to the same connection.

A total of 4 are needed.

Guess you like

Origin blog.csdn.net/qq_41929714/article/details/129714420