Week3 A
Week3 A
• Every row must be unique (can’t have two rows with exactly the same
values for all their fields).
Foreign keys are identifiers that enable a dependent relation (on the
many side of a relationship) to refer to its parent relation (on the one
side of the relationship).
Keys
Keys can be simple (a single field) or composite (more than one field).
Keys usually are used as indexes to speed up the response to user queries.
Transforming E-R into Logical Model
Logical Model
Foreign Key
Personnel{SSN, P_Name, Dep_No}
Department{Dep_No, Dep_Name}
Personnel_Phone{SSN,Phone}
N:M Relationship
Logical Model
Customer{C_No, C_Name, C_Address}
Product{P_No, P_Name, Price}
Customer-Product{C_No,P_No} OR
{ID, C_No, P_No}
1:1 Relationship
Logical Model
A- Employee{SSN, Name, ID}
Parking Place{ID, Location}
B- Employee{SSN, Name}
Parking Place{ID, Location, SSN}
Composite Attribute
Logical Model:
Customer{Customer_ID, C_Name, C_Street,C_City}
Multivalued Attribute
Logical Model:
Employee{E_ID, E-name}
Employee-Languages{E_ID, E-languages}
Weak Entity
Logical Model:
Employee{E_ID, E_name}
Dependent{D_ID,E_ID, F_name, L_name}
Ternary relationship
Logical Model:
Patient{Patient_ID, Patient_name}
Physician{P_ID,P_name}
Treatment{Treatment_code, Treatment_description}
Patient-Physician-Treatment{Patient_ID, P_ID,
Treatment_code}
Supertype/subtype relationships
Supertype/subtype relationships
References
• Modern Database Management 11th Edition, Jeffrey A. Hoffer, V. Ramesh,
Heikki Topi © 2013 Pearson Education, Inc. Publishing as Prentice Hall
• https://www.tutorialspoint.com/dbms/er_diagram_representation.htm