Top Banner
DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria PAGE 1 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes FREE, NOT FOR SALE! Part of abridged lecture notes for DCS209: Introduction to Database Management (I) prepared and delivered by Adamu Auwal Gene MCPN @IACC, Ahmadu Bello University, Zaria Nigeria
24

A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

Mar 11, 2018

Download

Documents

tranquynh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 1 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

Part of abridged lecture notes for

DCS209: Introduction to Database Management (I)

prepared and delivered by

Adamu Auwal Gene MCPN @IACC, Ahmadu Bello University, Zaria – Nigeria

Page 2: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 2 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

A Gentle Introduction to E-R Modeling

Abridged Lecture Notes For

DCS 209: Introduction to Database Management (I)

Diploma in Computer Science

Year II, Semester I

Prepared and Delivered

By

Adamu Auwal Gene MCPN Chartered Information Technology Professional

@Iya Abubakar Computer Centre, Ahmadu Bello University, Zaria – Nigeria

Last Updated: September, 2013

Page 3: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 3 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

CONTENTS 1.0 INTRODUCTION .............................................................................................................. 4

1.1 What is an E-R Model? ................................................................................................ 4

1.2 Main Components of E-R Models ............................................................................... 5

1.2.1 Entities ................................................................................................................. 6

1.2.2 Relationships ........................................................................................................ 6

1.2.3 Cardinalities and Modalities ................................................................................ 6

2.0 E-R MODELING USING CROW'S FOOT NOTATION ........................................................ 8

2.1 First, The Chen Notation ............................................................................................. 8

2.2 Crow’s Foot Notation .................................................................................................. 9

2.3 Crow’s Foot E-R Symbols ........................................................................................... 10

2.4 Steps in Creating E-R Diagrams ................................................................................. 11

2.5 Example 1: Drawing an ERD for student-seat relationship ....................................... 11

2.6 Example 2: Drawing an ERD for lecturer-course relationship .................................. 12

2.7 Example 3: Drawing an ERD for professor-course section relationship ................... 12

2.8 Example 4: Drawing an ERD for an online application form sales portal ................. 13

2.9 Summary of Important Tips on E-R Modeling ........................................................... 14

3.0 CASE STUDY: SKY-POWER AEROCORP ........................................................................ 16

3.1 The business rules of SKY-POWER AEROCORP ......................................................... 16

3.2 Identifying the major entities and relationships for SKY-POWER AEROCORP .......... 17

3.3 Drawing the E-R diagram for SKY-POWER AEROCORP ............................................. 19

4.0 FURTHER STUDIES (FOR YOUR PRACTICE) ................................................................... 21

4.1 KiddieBubbles children’s swimming club .................................................................. 21

4.2 Tom & Jerry fans online forum.................................................................................. 22

4.3 Students’ projects and supervisors ........................................................................... 22

Page 4: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 4 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

1.0 INTRODUCTION

ELCOME TO data modeling using E-R diagrams. This manual

covers just one topic in the overall syllabus for DCS209 –

Introduction to Database Management (I). Other topics for

the course are covered in separate manuals which are made

available to students as those topics are covered in the class. You can

download all the separate lecture notes for this course at my website,

which can be accessed anytime at the following URL:

http://www.auwalgene.com/mystudents/lecturenotes

1.1 What is an E-R Model?

The phrase “E-R Model” fully

stands for entity-relationship

model; and you can easily

understand that there are at least

three elements involved in this

phrase viz: entity, relationship and

model. A model is simply a

symbolic representation of

something; and in this case we use

simple diagrams to do our E-R

modeling. An entity refers to a

concept or an object (“a

something”, if you like) that we

are interested in. As for

relationship, well, we can say that

relationships exist between

entities. So in summary, the

business of this manual is simply

to teach you how to

diagrammatically explain entities

and the relationships that exist

between or among those entities.

As you already know from

previous class discussions, this

course is primarily about

relational databases; and this

manual is designed to cover just

one aspect of relational database

design and development.

In software engineering an entity-

relationship diagram (or E-R

diagram) is a data modeling

technique that creates a graphical

representation of the entities, and

the relationships that exist

between entities, within an

information system. It is a

database modeling method used

to produce a type of conceptual

W

Page 5: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 5 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

GOOD TO KNOW

There are quite a number of E-R

diagramming notations such as Chen,

IDEF1X, Bachman, UML and Min-Max/ISO

notations (among others). It is worth

knowing as well that "object oriented"

approaches to E-R modeling or E-R

diagramming are also very popular these

days.

In this manual, our focus will be on E-R

diagramming using crow's foot notation.

schema or semantic data model of

a relational database system,

using simple diagrams.

E-R diagrams are usually drawn at

an early stage of relational

database development; and they

are continually refined as the

requirements of the database and

its processing become better

understood. These diagrams of the

E-R model are meant to help

business owners, database

designers and programmers

understand the data needs and

business rules of the organization

for which they are building the

database system.

These days, nearly all systems

analysis and design methodologies

contain E-R modeling as an

important part of the

methodology; and nearly all CASE

(Computer Aided Software

Engineering) tools contain the

facility for drawing E-R diagrams.

It is also important to note that an

E-R diagram could serve as the

basis for the design of the actual

files in a conventional file-based

system as well as for a schema

diagram in a relational database

system.

1.2 Main Components of E-R Models

So, now we understand that E-R

models are basically sketch

diagrams used to model data in

order to help people understand

databases better. It is quite easy

to come up with such E-R models

and draw their diagrams; though

there are many different

approaches or notations used to

draw such diagrams.

Page 6: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 6 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

Each method or notation has its

own conventions which vary

slightly from one another; but

they all have the same basic

elements: entities (or entity

types), relationships and

cardinalities. These three

elements are generally considered

to be sufficient in order to model

the essentially static data-

dependent parts of any

organization’s information

processing needs. Each of these

three important elements of E-R

diagrams are next explained in

turn.

1.2.1 Entities

The entity is a person, object,

place or event for which data is

collected and stored. For example,

if you consider the information

system for a business, entities

would include not only customers,

but the customer’s address, and

the orders placed by the customer

as well. The entity is represented

by a rectangle and must be labeled

with a singular noun.

1.2.2 Relationships

The relationship is the interaction

between the entities. In the

example above, the customer

places an order, so the word

“places” defines the relationship

between that instance of a

customer and the order or orders

that s/he places.

Depending on the notation used, a

relationship may be represented

by a diamond shape, or just by the

line connecting the entities. In

either case, verbs are used to label

the relationships.

1.2.3 Cardinalities and Modalities

Finally, cardinality and modality

are the indicators of the “business

rules” around a relationship.

Cardinality refers to the

maximum number of times an

instance in one entity can be

associated with instances in the

related entity. Modality refers to

the minimum number of times an

instance in one entity can be

Page 7: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 7 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

associated with an instance in the

related entity.

There are several different types

of cardinality notation; but the

crow’s foot notation (which is our

focus in this manual) is a common

one.

In crow’s foot notation, a single

bar indicates one, a double bar

indicates one and only one (for

example, a single instance of a

product can only be stored in one

warehouse), a circle indicates

zero, and a crow’s foot indicates

many. The three main cardinal

relationships are: one-to-one,

expressed as 1:1; one-to-many,

expressed as 1:M; and many-to-

many, expressed as M:N.

Page 8: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 8 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

2.0 E-R MODELING USING CROW'S FOOT NOTATION

There are various ways or notations of drawing E-R diagrams. Two

common approaches are the Chen notation and crow’s foot notation.

2.1 First, The Chen Notation

Fig. 1 is a rather extra colorful example of Chen’s style of E-R Modeling.

This is a model of a relatively simple game software actually. But even at

that, I could imagine you being overwhelmed by its seeming complexities

already!

Fig. 1: Sample

E-R diagram in

Chen notation.

In the Chen E-R diagram shown in

Fig. 1, the entities are represented

by a rectangle containing the

entity’s name. The entity name is

Page 9: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 9 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

always a noun, and is usually

written in all capital letters. The

line between the entities

represents a relationship; and the

relationship itself is written inside

a diamond shape.

Notice that some entities and

relationships have double lines

while some have single lines.

These have special implications in

the notation used but since our

interest is not in Chen notation of

E-R Modeling, we shall not bother

to explain the intricacies.

The above is just meant to let you

see how E-R diagrams are drawn

in that notation, using various

symbols to mean different things.

2.2 Crow’s Foot Notation

In crow’s foot notation, each entity

is represented by a rectangle, with

the name of the entity written in

uppercase in the rectangle

(examples are CUSTOMER,

PRODUCT and ORDER in Fig. 2).

We shall modify this basic

representation later in order to

also accommodate the attributes

of the entities.

Relationships are represented by

simple lines that connect the

related entities, with a single verb

or a short verbal phrase that

describes the relationship

(examples are “serves”, “lists”, and

“places” in Fig. 2).

Fig. 2: Sample E-R diagram in crow’s foot notation.

Page 10: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 10 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

2.3 Crow’s Foot E-R Symbols

The following symbols are important in drawing E-R diagrams when using

the crow’s foot notation. You must carefully study and understand the

meaning of each symbol; and you must understand how to use them

correctly when drawing E-R diagrams:

- A single bar indicates one, a double bar indicates one and only one, a

circle indicates zero, and a crow’s foot indicates many.

- Modality can be 1 or 0 and the symbol is placed on the inside, next to

the cardinality symbol. For a modality of 1 a straight line is drawn.

For a modality of 0 a circle is drawn.

- For a cardinality of 1 a straight line is drawn. For a cardinality of

many a foot with three toes is drawn.

one or many one and only one

zero or one zero or many

Crow’s Foot Symbol Cardinality

(1,1) – one and only one

(1,N) – one or many

(0,1) – zero or one

(0,N) – zero or many

Page 11: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 11 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

GOOD TO KNOW

The crow's foot notation was

invented by Gordon Everest, who

originally used the term "inverted

arrow" but eventually got to just

call it a "fork". For cardinality, the

many "toes" on a fork or crow's

foot intuitively indicates "many".

2.4 Steps in Creating E-R Diagrams

The steps involved in creating an ERD are very

simple:

o Identify the entities.

o Determine all significant interactions.

o Analyze the nature of the interactions.

o Draw the E-R diagram.

2.5 Example 1: Drawing an ERD for student-seat relationship

Let us begin with a simple

example relationship between a

student and a seat. Let’s say

during a lecture or an exam for

example, a student occupies a seat.

This is a 1:1 relationship, meaning

that 1 student can occupy a

maximum of 1 seat and 1 seat can

be occupied by a maximum of 1

student. A student cannot take

two seats, and a seat is not to be

shared by two (or any more

students).

NOTE: It would be possible to

have one or more empty seats in

the class or hall if the students are

fewer than the maximum capacity

of the class or hall (i.e. seats

occupied by zero students). In

that case, the modality of the seat-

student relationship could be 0.

But we do not want to store

information about empty seats

anyway, so no need to worry

about that.

So, each side of this relationship

has a cardinality of 1 and the

modality on each side is also 1. We

can thus draw our E-R diagram as

follows:

Fig. 3: One and only one student sits on one and only one seat.

Page 12: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 12 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

2.6 Example 2: Drawing an ERD for lecturer-course relationship

In this example, we consider the

relationship between a university

lecturer and a course. Obviously, a

lecturer teaches a course. Let us

take it that “one lecturer may teach

one or many courses, but any

course can be taught by only one

lecturer.” In other words, Mr.

Gene may teach a course called

DCS209 and he may also teach

another course called DCS106; but

no single course may be co-taught

by two or any more lecturers.

So according to this business rule

we have defined, a lecturer must

teach at least 1 course, and a

course must be taught by only 1

lecturer. If we move from the

lecturer side towards the course

side of this relationship, the

modality is 1 and the cardinality is

N.

If we now move in the opposite

direction from the course side to

the lecturer side however, we see

that the modality is 1 and the

cardinality is also 1:

Fig. 4: A lecturer may teach one or many

courses, but a course is taught by one and

only one lecturer.

2.7 Example 3: Drawing an ERD for professor-course section

relationship

Now let’s look at yet another

interesting example: we have

seen that a lecturer may teach

many courses, but a course shall

be taught by one and only one

lecturer. Now let’s modify that a

bit and assume that there are

professors who teach in the

university too.

Page 13: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 13 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

Now, professors are very busy

people, so they don’t teach whole

courses. Instead, they teach

sections of courses. So our

business rule here can say “a

professor may or may not teach a

section of a course; such that one

professor can teach many sections

of a course, and a section of a

course can only be taught by one

professor”.

When we move from professor to

course in this relationship, it is

possible that a professor may not

teach a section at all, so the

modality is zero on that side of the

relationship. On the other hand, a

professor may actually teach a

section, or more than a section. So

the cardinality is N.

If we now move in the opposite

direction from course section to

professor in this relationship, we

see that a section must be taught

by one and only one professor, not

by more than one professor.

Hence, the modality is 1 and the

cardinality in that direction is also

1. This can be represented as

follows:

Fig. 5: A professor may teach

zero or many course sections; a

course section is taught by one

and only one prof.

2.8 Example 4: Drawing an ERD for an online application form sales

portal

Now let us look at this last

example: a certain university has

many programmes of study and all

application forms into the various

programmes of the university are

purchased, filled, submitted and

processed online through a

harmonized "eforms portal".

Assume part of the business rules

of the eforms portal states that

Page 14: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 14 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

"every applicant creates one and

only one account; and a single

applicant's account may be linked

to one or many form purchases; but

any form that is purchased must be

linked to one and only one account

(i.e. a form cannot be bought

through two or more different

applicants' accounts)".

Well, Fig. 6 shows the necessary E-

R diagram to model this business

rule; and you shall be called upon

to explain this to the class – so be

ready for it when the time comes!

Fig. 6: Any applicant needs only one account; and that one account links to one or more application forms.

2.9 Summary of Important Tips on E-R Modeling

By now you must have understood

the role played by E-R diagrams in

database design process. A

completed E-R diagram is the

actual blueprint of the database.

Its composition must reflect an

organization's operations

accurately if the database is to

meet that organization's data

requirements. It forms the basis

for a final check on whether the

included entities are appropriate

and sufficient, on the attributes

found within those entities, and on

the relationships between those

entities. It is also used as a final

crosscheck against the proposed

data dictionary entries. The

completed E-R diagram also lets

the designer communicate more

precisely with those who

commissioned the database

design. Finally, the completed E-R

diagram serves as the

implementation guide to those

who create the actual database. In

short, the E-R diagram is as

important to the database

designer just as a blueprint is to

the architect and builder.

In summary, always bear the

following important points in

mind whenever you are modeling

databases with E-R diagrams:

Page 15: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 15 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

Every entities in an ERD must be clearly named in a way that

everybody understands exactly what is being represented.

The names of all entities must be in the singular, not plural.

When there are two entities whose information is somehow

dependent on one another or connected with each other, those

entities are said to have a relationship between them (e.g. an

EMPLOYEE entity may have many QUALIFICATION entities

associated with it).

Relationships between entities are evaluated in both directions to

determine what type of relationship exists. The relationships must be

clearly indicated for both directions (we used dashed arrows in this

manual to indicate relationships).

The cardinalities of the relationship(s) between entities are

described by numbers and letters N, M. (e.g. 0:1, 1:1, 1:N, N:M).

Cardinalities must always be clearly indicated in both directions of

the relationships.

Optionally, there should be (if available or known) a clear indication

of a unique identifier for each occurrence of the entity (e.g. student

MATRIC_NUMBER to uniquely identify every STUDENT entity). Mark

the unique identifiers by underlining the unique identifiers.

Page 16: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 16 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

3.0 CASE STUDY: SKY-POWER AEROCORP

SKY-POWER AEROCORP is a

global air travel and cargo

handling business enterprise. The

company has many different types

of aircrafts, crews and managers

at various cities around the world.

The company desires to build a

central database system to

manage information about their

various activities around the

world; and part of the database

development effort involves

requirements gathering and

analyses. Some few parts of the

requirements have already been

gathered and summarized as

business rules, which are given in

section 3.1 of this manual.

As a database engineer, you are

now called upon to draw a

preliminary data model diagram,

using crow’s foot notation, which

would represent the few business

rules given in 3.1.

3.1 The business rules of SKY-POWER AEROCORP

i. A flight may take off from one and only one airport at a time; but an

airport may have more than one flight taking off simultaneously.

ii. A flight is managed by one and only one cabin crew.

iii. On any given flight, a passenger boarding a plane may belong to one

and only one flight class (business, economy or first class); while any

flight class may have no passenger at all, or more than one passenger.

Page 17: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 17 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

iv. Any flight ticket may be reserved by one and only one passenger; but

a passenger may reserve one or more flight tickets.

v. A cargo package may pass through more than one transit point

before reaching its final destination; and a transit point may handle

zero or many cargo packages.

vi. A flight crew is headed by a captain at a time, and a captain may head

only one flight crew at a time.

vii. A passenger on board a flight may eat more than one plate of food,

but any plate of food may be eaten by zero or one and only one

passenger on board.

viii. After meals on board, every passenger must wash at least one plate;

and every plate may be washed by more than one passenger.

ix. Each plane that is airborne must have two flight engineers onboard;

and any flight engineer may service one and only airborne plane at a

time.

x. At approximately every 4–6 months, each plane is parked in one and

only one hangar for a routine B-Check maintenance; and any hangar

may have zero or many aircrafts parked in it.

3.2 Identifying the major entities and relationships for SKY-POWER

AEROCORP

We can easily identify the major entities by going through the given

business rules one after the other:

Rule (i) suggests that there are two important entities called FLIGHT

and AIRPORT; and the relationship is take off.

Rule (ii) suggests FLIGHT and CABIN CREW as the main entities; while

the relationship is manage.

Page 18: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 18 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

Rule (iii) suggests FLIGHT, PASSENGER and FLIGHT CLASS as

possible entities; but we can drop FLIGHT and just take PASSENGER

and FLIGHT CLASS as possible entities needed to model the business

rule. The relationship here is belongs to.

Rule (iv) suggests FLIGHT TICKET and PASSENGER as the major

business entities. Notice that a RESERVATION will also be an entity,

but we can leave that out for now. The relationship is reserves.

Rule (v) suggests CARGO PACKAGE and TRANSIT POINT as the key

entities of interest; and the relationship here is passing through.

Rule (vi) provides FLIGHT CREW and CAPTAIN as major entities

involved in this business requirement; and the relationship is

heading (of the crew by the captain).

Rule (vii) gives PASSENGER, FLIGHT and PLATE OF FOOD as the three

possible entities. We take PASSENGER and PLATE OF FOOD as the

important ones here, though; and the relationship is eating (of the

plate of food by the passenger).

Rule (viii) focuses mainly on PASSENGER and PLATE as the important

entities; and the relationship is washing (of the plates by the

passenger).

Rule (ix) presents PLANE and FLIGHT ENGINEER as the important

entities; and the relationship is servicing (of the plane, by the

engineer).

Rule (x) gives PLANE and HANGAR as main entities; and the

relationship is park.

Page 19: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 19 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

3.3 Drawing the E-R diagram for SKY-POWER AEROCORP

Now we draw the E-R diagrams for each of the business rules one after the

other. Be sure to be in class when these diagrams are explained; as there

are many things not mentioned in this manual about the diagrams, but they

shall be carefully explained in class!

Fig. 7

Fig. 8

Fig. 9

Fig. 10

Fig. 11

Page 20: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 20 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

Fig. 12

Fig. 13

Fig. 14

Fig. 15

Fig. 16

CLASS EXERCISE: Can anyone now volunteer to try and combine all of the

above individual diagrams into one huge, unified E-R diagram?

Page 21: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 21 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

4.0 FURTHER STUDIES (FOR YOUR PRACTICE)

This last part of this manual contains three sample case studies that you

should explore in order to further understand business rules analysis and

E-R Modeling. You are strongly advised to carefully analyse each case

study and try to construct E-R diagrams that would model the stated

business rules as accurately as possible. You may work alone on your own,

or better still, form study groups of three or four and work together.

4.1 KiddieBubbles children’s swimming club

KiddieBubbles is a swimming club for children

aged 4 years to 12 years. The club has a

number of policies concerning the club, as

provided below. For each statement, draw its

corresponding E-R diagram using crow’s foot

notation:

i. Any child may belong to one and only one swimming group at a

time; and any swimming group may have one or many children

belonging to it.

ii. A swimming pool may have zero or many children swimming in it

at any time; but any child may be swimming in one and only one

pool at a time.

iii. On any given day, a life guard may rescue zero or many children;

and any child may not be rescued at all, or may be rescued one

and only once.

iv. A life guard oversees two swimming groups, and any swimming

group is overseen by two or more life guards.

Page 22: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 22 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

4.2 Tom & Jerry fans online forum

Fans of the popular Tom & Jerry cartoon

series have an online forum where they

share memories of various episodes or

scenes of the series. Members of the fans

forum have a set of rules that guide their

activities on the forum as detailed below. For

each statement, draw its corresponding E-R

diagram either individually or as a composite diagram:

i. Each fan may post zero or many messages on the forum wall; and

the forum wall may have zero or many messages posted.

ii. Each fan may comment on a wall post once or many times; and a

wall post may have zero or many comments on it.

iii. The webmaster may block many or no user accounts, and a user

account may be blocked many times or at no time at all.

iv. Each member may subscribe to one and only one group at a time

on the forum; and each group may have zero or many members

subscribed to it.

v. Each group is managed by one and only one sys admin, and a sys

admin may manage one and only one group.

4.3 Students’ projects and supervisors

The following statements are part of the business rules for a large database

system that models students’ projects in an academic institution. For each

statement, draw its corresponding E-R diagram using crow’s foot notation:

Page 23: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 23 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

i. A project group consists of more than one student; and a student

may belong to one and only one project group.

ii. A project supervisor supervises one or more project groups; but

any project group is supervised by one and only one supervisor.

iii. A project group conducts research on one and only one project

topic; and a project topic may be researched by one and only one

project group.

iv. A project report is reviewed by two or more supervisors; and any

supervisor may review zero or many project reports.

Page 24: A Gentle Introduction to E-R Diagramming - Auwal Genemystudents/lecturenotes/er_modeling.pdf@Iya Abubakar Computer Centre, Ahmadu Bello University, ... 12 2.7 Example 3 ... A Gentle

DCS209 Course Manual: A Gentle Introduction to E-R Modeling 2012 © IACC, ABU Zaria

PAGE 24 Downloaded from http://www.auwalgene.com/mystudents/lecturenotes

FREE, NOT FOR SALE!

WE’RE DONE FOR NOW, GOOD BYE!

ELL, that will be all in this brief introduction to data

modeling using the crow’s foot notation of E-R diagramming. I

hope you found it both useful and enjoyable. We shall be

discussing more about E-R Modeling when we consider the main case study

for this course in another DCS209 course manual.

Download more resources at: http://www.auwalgene.com/mystudents/lecturenotes

Connect with me on Facebook at: http://www.facebook.com/auwalgene3

Drop me a comment or two on my website: http://www.auwalgene.com/comments

Tell me something via e-mail at: [email protected]

Send SMS text messages to my mobile phone at +234 (0) 8032126160

Thank you for reading, and happy database development!

W