Prepared by: Jasmine A. Tulin
PHYSICAL DATABASE
DESIGN
Prepared by: Jasmine A. Tulin
Conversion of entity types
• Create a relation R for each
entity type E, and include
all general attributes of E
as columns of R.
• Add only subcomponents
of attributes as columns of
R if they are composite
attributes.
• Specify one of the key
attributes of E as the
primary key or R
• Create a relation R for
multivalued attribute MA
which is in an entity type E.
PERSON
SSN
Name(First, Last)
Address
Birthdate
{Hobbies}
[Age]
Prepared by: Jasmine A. Tulin
Conversion of 1:1 relationship types
• Assume that the
two entity types
participating in a
relationship are S
and T.
• Add the primary
key of T as the
foreign key of S.
• Add all general
attributes of the
relationship to S.
NURSE
NurseID
NurseName
CENTER
CenterID
CenterLocation
Prepared by: Jasmine A. Tulin
Conversion of 1:N relationship types
• Assume that the two
entity types participating
in a relationship are S(N-
side) and T(1-side).
• Add the primary key of T
as foreign key of S.
• Add all general
attributes of the
relationship to S.
STUDENT
StudID
StudName
DEPARTMENT
DeptCode
DeptName
Prepared by: Jasmine A. Tulin
Conversion of M:N relationship types
• Assume that the two entity
types participating
relationship are S and T.
• Create a new relation R for
the relationship.
• Add all general attributes
of the relationship to R.
• Add the primary key of S
and T as foreign key of R.
• The primary key of R is a
combination of the foreign
key from S and the foreign
key from T.
STUDENT
StudID
StudName
SUBJECT
SubjectCode
Description
Units
Prepared by: Jasmine A. Tulin
Conversion of N-ary relationship types
(N > 2)
• Create a new relation R that
represents each N-ary relationship.
• Add all general attributes of the
relationship as columns of R.
• The primary key of all entities
participating in a relationship as
foreign key of R.
• The primary key of S is a
combination of all foreign keys. (If
the foreign key is from a relationship
with a cardinality of 1, it is not
included in the combination for the
primary key.)
STUDENT
StudID
StudName
SUBJECT
SubjectCode
Description
Units
TEACHER
TeacherID
Name
Section
Semester
SY
Prepared by: Jasmine A. Tulin
Conversion of generalized
relationships
• Create a table that represents each of the super entity types
and sub entity types.
• Add the primary keys of the tables representing super entity
types to the tables of sub entity types
Prepared by: Jasmine A. Tulin
Exercise – ERD for a restaurant
SEATING
SeatingID
Nbr_of_Guests
StartTimeDate
EndTimeDate
TABLE
TableNbr
TableNbrSeats
TableRating
TipsEarned
WAITER
HourlyWage
{Specialty}
MANAGER
MonthlySalary
EMPLOYEE
EmployeeID
Name(Fname, Lname)
Prepared by: Jasmine A. Tulin
PROCEDURE
Procedure Core
Procedure Name
Cost
TimeOfProcedure
DateOfProcedure
DOCTOR
Specialty
PATIENT
{MedicalHistory}
PERSON
PID
Name(Fname, Lname)
d

PHYSICAL DATABASE DESIGN - Relational Database Management System

  • 1.
    Prepared by: JasmineA. Tulin PHYSICAL DATABASE DESIGN
  • 2.
    Prepared by: JasmineA. Tulin Conversion of entity types • Create a relation R for each entity type E, and include all general attributes of E as columns of R. • Add only subcomponents of attributes as columns of R if they are composite attributes. • Specify one of the key attributes of E as the primary key or R • Create a relation R for multivalued attribute MA which is in an entity type E. PERSON SSN Name(First, Last) Address Birthdate {Hobbies} [Age]
  • 3.
    Prepared by: JasmineA. Tulin Conversion of 1:1 relationship types • Assume that the two entity types participating in a relationship are S and T. • Add the primary key of T as the foreign key of S. • Add all general attributes of the relationship to S. NURSE NurseID NurseName CENTER CenterID CenterLocation
  • 4.
    Prepared by: JasmineA. Tulin Conversion of 1:N relationship types • Assume that the two entity types participating in a relationship are S(N- side) and T(1-side). • Add the primary key of T as foreign key of S. • Add all general attributes of the relationship to S. STUDENT StudID StudName DEPARTMENT DeptCode DeptName
  • 5.
    Prepared by: JasmineA. Tulin Conversion of M:N relationship types • Assume that the two entity types participating relationship are S and T. • Create a new relation R for the relationship. • Add all general attributes of the relationship to R. • Add the primary key of S and T as foreign key of R. • The primary key of R is a combination of the foreign key from S and the foreign key from T. STUDENT StudID StudName SUBJECT SubjectCode Description Units
  • 6.
    Prepared by: JasmineA. Tulin Conversion of N-ary relationship types (N > 2) • Create a new relation R that represents each N-ary relationship. • Add all general attributes of the relationship as columns of R. • The primary key of all entities participating in a relationship as foreign key of R. • The primary key of S is a combination of all foreign keys. (If the foreign key is from a relationship with a cardinality of 1, it is not included in the combination for the primary key.) STUDENT StudID StudName SUBJECT SubjectCode Description Units TEACHER TeacherID Name Section Semester SY
  • 7.
    Prepared by: JasmineA. Tulin Conversion of generalized relationships • Create a table that represents each of the super entity types and sub entity types. • Add the primary keys of the tables representing super entity types to the tables of sub entity types
  • 8.
    Prepared by: JasmineA. Tulin Exercise – ERD for a restaurant SEATING SeatingID Nbr_of_Guests StartTimeDate EndTimeDate TABLE TableNbr TableNbrSeats TableRating TipsEarned WAITER HourlyWage {Specialty} MANAGER MonthlySalary EMPLOYEE EmployeeID Name(Fname, Lname)
  • 9.
    Prepared by: JasmineA. Tulin PROCEDURE Procedure Core Procedure Name Cost TimeOfProcedure DateOfProcedure DOCTOR Specialty PATIENT {MedicalHistory} PERSON PID Name(Fname, Lname) d