You are on page 1of 4

DFC 20203 DATABASE DESIGN

LAB ACTIVITY 2: Relational Data Model – PART 2


Duration: 4 hours

Learning Outcomes
This activity encompasses activities 2E and 2G.
By the end of this tutorial session, you should be able to:
1. Identify relations key: Primary key, Candidate key and Foreign key
2. Understand integrity rules:
a. Entity integrity
b. Referential integrity

SCENARIO

Infinity Design Solution Sdn. Bhd, an advertising company wants to automate the system
of managing Human Resources (HR) data. Miss Suria was selected to be an IT
programmer for Infinity Design Solution. En. Mohamed insist to develop a system to
manage staff payroll. Miss Suria needs to prepare preliminary research about the
components of a relations key and integrity rules.

INSTRUCTION:
Answer the entire questions below.

Activity 2E
Activity Outcome : Identify relations key: Primary key, Candidate
key and Foreign key

1. Briefly explain the following relation keys.

Primary
Key

Candidat
e Key

Foreign
Key

Page 15 of 57
DFC 20203 DATABASE DESIGN

2. Determine the primary key and foreign key for each table in ORDER_STATIONERY
database.

CUSTOMER_T
Customer_No Customer_Name Customer_Address
1234 DIYA NATASHA DIYA ENT. KUCHING SARAWAK
2345 FILA AZIRA FILARA SDN. BHD, MIRI SARAWAK
3456 RINA WAFIZA RIZA ENT. SIBU SARAWAK
4567 HARITH FAZLY HARITH SDN. BHD, MIRI SARAWAK
5678 JERRY STANLEY JERRY ENT. MUKAH SARAWAK

PRODUCT_T
Product_No Product_Description Product_Unit_Price
A123 PENCIL 0.30
B234 ERASER 0.20
C345 SHARPENER 0.50
D456 RULER 0.80
E567 PEN 1.00

ORDER_T
Order_No Order_Date Customer_No
1111 2014-02-01 1234
1122 2014-02-05 3456
1133 2014-02-21 5678
1144 2014-03-30 2345
1155 2014-04-01 4567

ORDER_PRODUCT_T
Order_No Product_No Quantity
1111 B234 100
1122 C345 150
1133 E567 120
1144 D456 150
1155 A123 200
1122 A123 150
1144 C345 120

Primary Key Foreign Key

CUSTOMER_T

PRODUCT_T

ORDER_T

ORDER_PRODUCT_T

Page 16 of 57
DFC 20203 DATABASE DESIGN

Activity 2F
Activity Outcome : Understand integrity rules: Entity integrity and
Referential integrity

Match the integrity rules below with its appropriate description.

Entity integrity Referential integrity

• Each instance of an entity must have a unique


primary key value that is not null

• Rules about the relationship between entities


• A referenced item in one table must exist in
another table

Page 17 of 57
DFC 20203 DATABASE DESIGN

Activity 2G
Activity Outcome : Identify relations key: Primary key, Candidate
key and Foreign key and Understand integrity rules: Entity integrity and Referential
integrity

An EMPLOYEE has only one JOB_CODE, but a JOB_CODE can be held by many EMPLOYEEs.
An EMPLOYEE can participate in many PLANs, and any PLAN can be assigned to many EMPLOYEEs.

1. Identify the primary keys and foreign keys of each table.

2. Do the tables exhibit entity integrity? Explain your answer.

3. Do the tables exhibit referential integrity? Explain your answer.

Page 18 of 57

You might also like