Lab 10 - Database Modeling

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

TEB2132 STRUCTURED PROG & DATABASE - LAB SESSION 10

DATABASE CONCEPTUAL MODELING

Learning Outcomes
Students should be able to:
(1) DESCRIBE and IDENTIFY entities, attributes and relationships that make up the
structure of relational database of a given problem.
(2) DESIGN Entity Relationship (ER) diagram for depicting structure of a relational
database .

Background/Introduction

There are three basic elements in an ER Diagram: entity,


Symbols in ER Diagram attribute, relationship.
• Entity describes a set of objects which has characteristics
• Attributes are the characteristics of entities
• Relationship shows connection between entities.
• Attributes could be identifier or non-identifier depending
on their values
• One of identifiers can be opted to be primary key of an
entity. It can describe all other attributes uniquely.
• Connectivity and Cardinality are two other notations used
in ER diagrams to further define relationships.
• Connectivity can be 1:1, 1:m and m:n
• Cardinality is minimum & maximum instances that might
involve in a relationship

Activity #1

Determine the degree of relationship and connectivity (i.e., 1:1, 1:m, m:n) if any, depicted in each
scenario below; and draw ERD to show the entities involved in the relationship (add few
attributes for each entity).
i. A lorry belongs to a transport company, and a transport company owns several
lorries.
ii. A student has a mentor among his/her peers. A student has one mentor who can
only mentor one student.
iii. An event has an organizer, a venue and many participants.
iv. A travel trip has multiple destinations, multiple travelers, and one tourist guide.
v. A room stores many equipment types, and an equipment type can be stored in many
rooms
TEB2132 STRUCTURED PROG & DATABASE - LAB SESSION 10
DATABASE CONCEPTUAL MODELING

Activity #2

Given the incomplete ER diagram below:

a) Add connectivity information to the diagram based on the following narration: A traffic police
officer can issue many summonses. However, a summons can only be issued by one traffic
police officer. Moreover, a summons is for one driver, and a driver might get more than one
summons.
b) Create a table for each of the entities above; and fill them with at least 3 lines of data each.
c) From the data entered in (b), determine which of the given attributes are identifiers in each
table
d) Select one of the identifiers to be the primary key for each table

Activity #3:

Read the scenario below and answer the questions that follow:

A database is needed to manage a soccer tournament. Below are the information related
to the tournament that need to be stored in the database:
• The tournament has a set of teams where each team has an ID (unique identifier),
name, main stadium, and the city the team belongs.
• Each team has many players, and each player belongs to one team. Each player has a
number (unique identifier), name, DoB, start year, and shirt number that he uses.
• Teams play matches. In each match there is a host team and a guest team. The
match takes place in the stadium of the host team at certain date and time. A match
has a result which specifies the point obtained by both teams along with the number
of goals they netted.
• Each match has exactly three referees and each of them has an ID (unique
identifier), name, DoB and years of experience.
.
Questions:
a) Draw all the entities and attributes mentioned in the given scenario (underline their
primary key).
b) Determine the relationships (and connectivities) between the entities; and construct the
relationships in the ERD in (a).
TEB2132 STRUCTURED PROG & DATABASE - LAB SESSION 10
DATABASE CONCEPTUAL MODELING

Activity #4: (To be submitted before next week’s lab)

An express bus company wants to hire a programmer to develop a bus trip system which can ease
its operation. In order to do that, the company needs to specify the data that will be involved and
saved in the database for the system. Below are the descriptions of those data:

Every trip made by a bus to a destination will be assigned one main driver. Each trip will have
passengers who purchases ticket. A ticket is owned by a passenger and a passenger can have
multiple tickets depending on the number of trips he/she takes. A destination has city code, city
name and city state. A trip has information such as trip ID, date of trip, time departure and
estimated arrival time. A driver has driver number, driver license number, driver name and driver
mobile number. A driver may drive different buses for different trips. A bus has bus registration
number and bus maximum capacity. A passenger has identity number, name and mobile number.

a) Identify all entities, except TRIP and PASSENGER, along with their attributes as mentioned
in the case study above.
b) Draw Entity Relationship (ER) diagram depicting the relationship between TRIP and
PASSENGER. [NOTE: No need to draw complete ER diagram with all entities]

You might also like