Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

CC 14.

1 - Database Systems and Information Management


---------------------------------------------------------------------------------------
Laboratory Activity 7 – Physical Database Design
(Due Date: November 9, 2022 before midnight)
-----------------------------------------------------------------------------------------

Learning Outcomes

By the end of this activity, the students should be able to:


1. Produce a basic working relational database schema from the logical data model
2. Decide on how to represent the base relations identified in the logical data model in the target
DBMS

Topics Covered

Physical Database Design

Prior Knowledge Required

1. Physical database schema


2. Introduction to MySQL
Materials and Resources

Open access materials available through Elearn and the web, and other text references

Instructions

This is a group activity. You need to work with your assigned group to complete this task.
1. Develop a relational schema for the logical data model for the MySQL relational DBMS and
decide on the representation and properties of the base relations, including:
a. Name of relation.
b. A list of simple attributes in brackets.
c. The primary key (PK), and where appropriate, alternate keys (AK), and foreign keys (FK)
d. Integrity constraints for any foreign keys identified.
e. For each attribute, identify its domain, consisting of data type, length and any constraints
on the domain, an optional default value for the attribute, whether the attribute can hold
nulls, and whether the attribute is derived and, if so, how it should be computed.
f. Indexes for efficient retrieval, if any,
2. Report format:
 Use A4 size document
 Font Times New Roman, size 12, bold, for headings, and size 11 for body texts
 Line Spacing is 1.15
 Margin: Left and Right: 0.8” on all sides
2. Save file as Activity7_Group#.
3. Upload soft copy of your output to eLearn.
4. As a guide, you may refer to the attached example on the next page.
5. Perform peer evaluation. No peer evaluation means zero for peer evaluation score (see scoring tool
below).
Scoring Tool

Relation Names (complete) 5


Attributes/Domain/Data Type/Length/Constraints 15
PK, AK and FK 10
Integrity Constraints and indexes 10
Peer Evaluation 20
TOTAL 60

______________________________________________________________________________________________________

Activity 7 Example

Company Database:
An Example Database Application
(Source: Fundamentals of Database Systems, 2nd edition, Elmasri & Navathe)

Logical Data Model


Physical Database Design
project (
pname varchar (15) NOT NULL default '',
pnumber int (11) NOT NULL default '0',
plocation varchar (15) default NULL,
dnum int (11) NOT NULL default '0',
PRIMARY KEY (pnumber),
UNIQUE KEY pname (pname)
)

dept_locations (
dnumber int (11) NOT NULL default '0',
dlocation varchar (15) NOT NULL default '0',
PRIMARY KEY (dnumber,dlocation),
FOREIGN KEY dnumber REFERENCES department(dnumber) on delete SET NULL on update CASCADE
)

employee (
fname varchar (15) NOT NULL default '',
minit char (1) default NULL,
lname varchar (15) NOT NULL default '',
ssn varchar (9) NOT NULL default '',
bdate date default NULL,
address varchar (30) default NULL,
sex char (1) default NULL,
salary decimal (10,2) default NULL,
superssn varchar (9) default NULL,
dno int (11) NOT NULL default '0',
PRIMARY KEY (ssn),
FOREIGN KEY superssn REFERENCES employee(ssn) on delete SET NULL on update CASCADE,
FOREIGN KEY dno REFERENCES department(dnumber) on delete SET NULL on update CASCADE
) INDEX on lname

department (
dname varchar(15) NOT NULL default '',
dnumber int(11) NOT NULL default '0',
mgrssn varchar(9) NOT NULL default '',
mgrstartdate date default NULL,
PRIMARY KEY (dnumber),
UNIQUE KEY dname (dname),
FOREIGN KEY mgrssn REFERENCES employee(ssn) on delete SET NULL on update CASCADE
) INDEX on dname

dependent (
essn varchar(9) NOT NULL default '',
dependent_name varchar(15) NOT NULL default '',
sex char(1) default NULL,
bdate date default NULL,
relationship varchar(8) default NULL,
PRIMARY KEY (essn,dependent_name),
FOREIGN KEY essn REFERENCES employee(ssn) on delete CASCADE on update CASCADE
)

works_on (
essn char(9) NOT NULL default '',
pno int(11) NOT NULL default '0',
hours decimal(3,1) default '0.0',
PRIMARY KEY (essn,pno),
FOREIGN KEY essn REFERENCES employee(ssn) on delete NO ACTION on update CASCADE,
FOREIGN KEY pno REFERENCES project(pnumber) on delete ACTION on update CASCADE
)

You might also like