0% found this document useful (0 votes)
8 views16 pages

Week3 A

Uploaded by

setoseto1907
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views16 pages

Week3 A

Uploaded by

setoseto1907
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Database Management Systems

Logical Database Design and The Relational


Model
Pınar Yıldırım
The Relational Model
• A relation is a named two dimensional table of data.

• A table consists of rows(records) and columns(attribute or fields).


Requirements
• It must have an unique name.

• Every attribute value must be atomic (not multivalued or composite).

• Every row must be unique (can’t have two rows with exactly the same
values for all their fields).

• Attributes(columns) in tables must have unique names.


Keys
 Keys are special fields that serve two main purposes:

 Primary keys are unique identifiers of the relation. Examples include


employee numbers, social security numbers, etc. This guarantees that
all rows are unique.

 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

One-to-Many–Primary key on the one side is added as a


foreign key on the other side

Many-to-Many–Create a new relation with the primary keys


of the two entities as its primary key

One-to-One–Primary key becomes a foreign key on optional


side
Transforming E-R into Logical Model
1:N Relationship

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

You might also like