Physical Database Design

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

PHYSICAL

DATABASE
DESIGN
Conversion of entity types

■ Create a relation R for each


PERSON
entity type E, and include all
general attributes of E as
SSN
columns of R. Name(First, Last)
Address
■ Add only subcomponents of Birthdate
attributes as columns of R if {Hobbies}
they are composite attributes. [Age]
■ Specify one of the key attributes
of E as the primary key or R
SSN First Last Address Birthdate Age
■ Create a relation R for
multivalued attribute MA which
is in an entity type E.

SSN HOBBIES
Conversion of weak entity types

■ Create a relation R for each EMPLOYEE


DEPENDENT
weak entity type W, and include Name
EmpID
all general attributes of W as DateOfBirth
Name
columns of R. Gender

■ Add the primary key of E as the


foreign key of R for W’s
identifying entity type E.
■ The primary key of R is a
EmpID Name
combination of E’s primary key
and W’s partial key.
DateOfBirt
EmpID Name Gender
h
Conversion of 1:1 relationship types
■ Assume that the two entity
types participating in a NURSE NURSE
relationship are S and T. NurseID CenterID
NurseName CenterLocation
■ Add the primary key of T
as the foreign key of S.
■ Add all general attributes
of the relationship to S.
NurseID NurseName

CenterID CenterLocation NurseID


Conversion of 1:N relationship types
■ Assume that the two entity types
STUDENT DEPARTMENT
participating in a relationship are
StudID DeptCode
S(N-side) and T(1-side). StudName DeptName
■ Add the primary key of T as
foreign key of S.
■ Add all general attributes of the
relationship to S. DeptCode DeptName

StudID StudName DeptCode


Conversion of M:N relationship types

■ Assume that the two entity types


participating relationship are S and T. SUBJECT
STUDENT
■ Create a new relation R for the SubjectCode
StudID
relationship. Description
StudName
Units
■ Add all general attributes of the
relationship to R.
■ Add the primary key of S and T as StudID StudName
foreign key of R.
■ The primary key of R is a
combination of the foreign key from
S and the foreign key from T. StudID SubjectCode

SubjectCode Descriptions Units


Conversion of N-ary relationship types (N > 2)

■ Create a new relation R that represents SUBJECT


each N-ary relationship. STUDENT Section
SubjectCode
StudID Semester
■ Add all general attributes of the SY Description
StudName
relationship as columns of R. Units
■ The primary key of all entities
participating in a relationship as foreign
key of R.
TEACHER
■ The primary key of S is a combination of
all foreign keys. (If the foreign key is TeacherID
from a relationship with a cardinality of 1, Name
it is not included in the combination for
the primary key.)
STUDENT ID SUBJECT
Section SubjectCode
StudID Semester Description
StudName SY Units

TEACHER
TeacherID StudID StudName
Name

Subject Teacher Semeste


ID StudID Section SY
Code ID r

TeacherID Name

SubjectCode Descriptions Units


STUDENT SUBJECT
Section,
SubjectCode
StudID Semester,
Description
SY
StudName Units

TEACHER
TeacherID StudID StudName
Name

SubjectCo TeacherI
StudID Semester Section SY
de D

TeacherID Name

SubjectCode Descriptions Units


Conversion of Supertype and SubType

■ 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
Exercise – ERD for a restaurant
SEATING
TABLE
SeatingID
Nbr_of_Guests TableNbr EMPLOYEE
StartTimeDate TableNbrSeats EmployeeID
EndTimeDate TableRating Name(Fname, Lname

D
TipsEarned

WATER
MANAGER
HourlyWage
MonthlySalary
{Specialty}
■ Virtual Campus (VC) is a social media firm that specializes in creating virtual meeting places for students, faculty,
staff, and others associated with different college campuses. VC was started as a student project in a database class
at Cyber University, an online polytechnic college, with headquarters in a research park in Dayton, Ohio. The
following parts of this exercise relate to different phases in the development of the database VC now provides to
client institutions to support a threaded discussion application. Your assignment is to draw an ERD to represent
each phase of the development of the VC database and to answer questions that clients raised about the capabilities
(business rules) of the database in each phase. The description of each phase will state specific requirements as seen
by clients, but other requirements may be implied or possibly should be implemented in the design slightly
differently than the clients might see them, so be careful to not limit yourself to only the specifics provided.
– A client may maintain several social media sites (e.g., for intercollegiate sports, academics, local food and
beverage outlets, or a specific student organization). Each site has attributes of Site Identifier, Site Name, Site
Purpose, Site Administrator, and Site Creation Date.
– Any person may become a participant in any public site. Persons need to register with the client’s social media
presence to participate in any site, and when they do the person is assigned a Person Identifier; the person
provides his or her Nickname and Status (e.g., student, faculty, staff, or friend, or possibly several such
values); the Date Joined the site is automatically generated. A person may also include other information,
which is available to other persons on the site; this information includes Name, Twitter Handle, Facebook
Page link, and SMS Contact Number. Anyone may register (no official association with the client is
necessary).
– An account is created each time a person registers to use a particular site. An account is described by an
Account ID, User Name, Password, Date Created, Date Terminated, and Date/Time the person most recently
used that account.
– Using an account, a person creates a posting, or message, for others to read. A posting has a Posting Date/Time
and Content. The person posting the message may also add a Date when the posting should be made invisible
to other users.
– A person is permitted to have multiple accounts, each of which is for only one site.
– A person, over time, may create multiple postings from an account.

You might also like