Data Center reconstruction-Database Design-Data Center reconstruction Database
I. Draw an ERTU
A E-R Diagram, also known as an Entity Relationship divisor, provides a way to represent Entity types, attributes, and associations to describe the conceptual models of the real world.
Drawing Method:
(1) determine all entity sets
(2) Select the attributes that the object set should contain.
(3) determine the relationship between entity sets
(4) determine the keywords of the object set, and use underscores to indicate the Attribute combination of the keywords.
⑸ Determines the contact type. When the diamond box Indicating the contact is connected to the entity set with a line, it indicates 1 or n (multiple) beside the line to indicate the contact type.
2. convert an erimage into a link mode
: For example, the relationship between CardInfo and StudentInfo is.
CardInfo (CardNo, Balance, CardState)
StudentInfo (StuID, StuName, StuDept, StuSex, StuClass, StuState)
After conversion
StudentInfo (StuID, CardNo, StuName, StuDept, StuSex, StuClass, StuState)
Or
CardInfo (CardNo, StuNo, Balance, CardState)
That is, you can add a primary key to either party.
1: n: for example, the relationship between UserInfo and CardInfo is 1: n in terms of registration.
UserInfo (UserID, Password, UserName, UserLevel)
CardInfo (CardNo, Balance, CardState)
After conversion
CardInfo (CardNo, UserID, Balance, CardState)
Put the primary key to the n-party
N: m: for example, the relationship between UserInfo and CardInfo is n: m in terms of recharge (one user can recharge multiple cards, and one card can be recharged by multiple users)
CardInfo (CardNo, Balance, CardState)
UserInfo (UserID, Password, UserName, UserLevel)
After conversion
CardInfo (CardNo, Balance, CardState)
UserInfo (UserID, Password, UserName, UserLevel)
Recharge (CardNo, UserID, Money, OpTime)
Add a new link mode and add the two primary keys to the new link mode respectively.
Iii. standardized database with three paradigms
1. First Paradigm (Atomicity)
No good examples are found in the system. Just give an example to illustrate the problem.
Non-first paradigm relationship
Department name |
Number of senior titles |
Professor |
Associate professor |
Computer System |
6 |
10 |
Information Management Department |
3 |
5 |
First paradigm relationship
Department name |
Number of Professors |
Associate Professors |
Computer System |
6 |
10 |
Information Management Department |
3 |
5 |
The number of senior titles in the first table is not an atomic attribute. It also includes two subvalues.
2. Second Paradigm (no local dependency exists)
Recharge (CardNo, UserID, Money, OpTime)
In this recharge relationship, CardNo and UserID determine the OpTime. Therefore, they are combined as the primary key, but CardNo can decide the Money on its own, so there is a local dependency.
Optimized
Recharge (CardNo, UserID, OpTime)
Balance (CardNo, Money)
That is, to meet the requirements of the second paradigm
3. Third Paradigm (excluding transmission dependencies)
No suitable example is found in this system. Other examples are provided to illustrate this problem.
Student (StuNo, StuDept, StuDeptTeacher)
StuNo can decide stuDept
StuDept can determine StuDeptTeacher
In this way, the transmission dependency exists.
After Optimization
Student (StuNo, StuDept)
Dept (StuDept, StuDeptTeacher)
4. Relationship between three paradigms
Satisfying the third paradigm must satisfy the first and second paradigms