0% found this document useful (0 votes)
125 views4 pages

Lab04 Sol

The document discusses implementing multivalued attributes in a relational database. It provides two examples of multivalued attributes: a car having multiple colors and a student having multiple phone numbers. It then describes two solutions for implementing multivalued attributes: 1) splitting the attribute into new attributes, and 2) creating a new entity. The document also includes an example of drawing an entity-relationship diagram based on business rules, identifying entities, relationships, and cardinalities between entities.

Uploaded by

Blackk Worldz
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)
125 views4 pages

Lab04 Sol

The document discusses implementing multivalued attributes in a relational database. It provides two examples of multivalued attributes: a car having multiple colors and a student having multiple phone numbers. It then describes two solutions for implementing multivalued attributes: 1) splitting the attribute into new attributes, and 2) creating a new entity. The document also includes an example of drawing an entity-relationship diagram based on business rules, identifying entities, relationships, and cardinalities between entities.

Uploaded by

Blackk Worldz
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/ 4

Database Fundamental (TIS 1101)

Tutorial 4

Q1. What is multivalued attribute? Give TWO examples.

Multivalued attribute is an attribute that can have many values. Examples:

1. A car (an entity) could have several different colors (a multivalued attribute)
on different parts of the car

2. A student (an entity) may have several mobile phone numbers (a multi
valued attribute).

Q2. Referring to Q1, explain briefly TWO solutions on how a multivalued attribute is
implemented in a relational database.

1. Within the original multivalued attribute (e.g., color attribute), split it to new
attributes (e.g., topcolor, bodycolor, interiorcolor, etc.)

2. Create a new entity from a multivalued attribute

1
Q3. Draw a complete E-R Diagram based on the following business rules:

 A company operates five departments.


 Each department has employees.
 Each employee works for only one department.
 The largest department has 30 employees.
 Each employee may or may not have one or more dependents.
 Computers are located in a designated room.
 Each employee may use any computer in the room.
 Each computer may be used by more than one employee on different days.

a) Identify all possible entities. Hint: An entity is normally a noun that can be found
in the business rule.
Company
Department
Employee
Dependent (please explain what a dependent is, students may not know)
Room
Day

b) Let’s examine each of the entities that are listed out. Is it necessary to include
every entity that can be found in the business rules? Explain your answer.

No, it’s not mandatory. A database should be concise.

Although the ERD (conceptual model) represents the global view of the
organization, not everything needs to be implemented in the physical model (the
way data are stored in memory/disk). E.g., the ‘room’ is a possible entity derived

2
from the business rules, but from a representation point of view, we do not need to
keep track on how the room is used.

c) Let’s examine the relationships between the entities. List out possible relationship
between every two entities you listed out in question 2(b), specify whether it is a
mandatory or optional relationship, and specify the cardinality (whether 1:1, 1:M,
M:N etc).

Entities Relationship Mandatory (M) Cardinality


or Optional (O)
DEPARTMENT, Employs M 1 department can hire a
EMPLOYEE maximum of 30 employees
While 1 employee can
belong to at most 1
department
EMPLOYEE, Has O 1 employee can have zero
DEPENDENTS or many dependents
While 1 dependent
depends on only 1
employee (a dependent can
claim benefit from only
one employee)
EMPLOYEE, Uses O Many employee can use
COMPUTER many computers while
many computers be used
by many employees

d) Complete the ERD using the elements you identified in steps Q3 (a) to (c).

DEPARTMENT
1 (1,30)

employs

M (1,1) M N
EMPLOYEE uses COMPUTER
(0, N) (0, N)
(0, N)

has
M (1,1)

DEPENDENTS

3
** Note to tutor: If time permits, can expose student to select records from table such as.

Create databse dbStudent

Connect to dbStudent

Create table STUDENT


(
student_id int,
name varchar(30),
age int,
gender char(1)
);

Insert into student values (100, ‘Abu’, 20, ‘M’);


Insert into student values (101, ‘Ali’, 25, ‘M’);
Insert into student values (101, ‘Aminah’, 22, ‘F’);

Select * from Student;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy