0% found this document useful (0 votes)
100 views

DBMS Lab 06 28102020 013107pm

This document provides information about entity relationship modeling for a database management systems lab manual. It defines key concepts like entities, attributes, and relationships. It explains one-to-one, one-to-many, many-to-one, and many-to-many relationships. It includes two examples for students to draw ER diagrams for: a medical test lab tracking patients, tests, and doctors, and a sports league tracking teams, players, games, positions, and results. Students are asked to show all entities, relationships, and cardinalities in their diagrams.

Uploaded by

Javeria Abbasi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

DBMS Lab 06 28102020 013107pm

This document provides information about entity relationship modeling for a database management systems lab manual. It defines key concepts like entities, attributes, and relationships. It explains one-to-one, one-to-many, many-to-one, and many-to-many relationships. It includes two examples for students to draw ER diagrams for: a medical test lab tracking patients, tests, and doctors, and a sports league tracking teams, players, games, positions, and results. Students are asked to show all entities, relationships, and cardinalities in their diagrams.

Uploaded by

Javeria Abbasi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1

Department of Computer Science


Bahria University, Islamabad

Fall 2020

Course Code : CSL-220

Database Management Systems

BS-IT-4AB

Lab Manual 6

Student Name: ________________________________

Enrollment Number: __________________________


1

Lab #6
 Entity Relationship Modeling
__________________________________________________________________________

Entity Relationship Modeling (ER Modeling) is a graphical approach to database


design. It uses Entity/Relationship to represent real world objects.
Entity
An Entity is a thing or object in real world that is distinguishable from surrounding
environment. Following are some of major characteristics of entities.
 An entity has a set of properties.
 Entity properties can  have values. 

For example each employee of an organization is a separate entity. If "Peter" is a


programmer (an employee) at Microsoft, he can have attributes (properties) like
name, age, weight, height, etc. It is obvious that those do hold values relevant to him.
Attributes
Each attribute can have Values. In most cases single attribute have one value. But it is
possible for attributes have multiple values also.  For example Peter's age has a single
value. But his "phone numbers" property can have multiple values.
Simple Attribute : When an attribute has a single value e.g. First Name, Last
Name, Age, House#, Street#
Composite Attribute : When an attribute has a group of related values e.g.
Name, Address
Multivalued Attribute : When an attribute can have multiple values e.g. Contact
Number, Email_Id
Relationships
Entities can have relationships with each other. Assume that each Microsoft
Programmer is given a Computer. It is clear that that Peter's Computer is also an
entity. Peter is using that computer and the same computer is used by Peter. In other
words there is a mutual relationship among Peter and his computer.
Connecting lines: solid lines connect attributes to show the relationships of entities in
the diagram

1|Page
To sum up, in Entity Relationship Modeling, we model entities, their attributes and
relationships among entities.
One of the challenges faced when designing database is the fact that designers,
developers and end-users tend to view data and its usage differently. If this situation
is left unchecked, we can end up producing a database system that does not meet
the requirements of the users. Tools such as ER Models are critical in producing
database systems that meet the requirements of the users.
Example
Suppose you are required to create a database system from the perspective of a
book agency. The simplest system should be able to record information of a novel, its
writer and readers.
In order to create an ER Diagram for this problem, database designer should identify
following items
Entities
Attributes of entities
Relationships between entities

ER Model Concept ER Diagram Representation

Entity

Relationship

Attributes
Multivalue D
Simple attribute d attribute erived attribute

Entities

2|Page
3

Attributes

Relationships

Complete ER Model

Attempt Task 1 before reading further.


Cardinality & Ordinality
3|Page
Cardinality specifies how many instances of an entity relate to one instance of
another entity. Ordinality is also closely linked to cardinality. While cardinality
specifies the occurrences of a relationship, ordinality describes the relationship as
either mandatory or optional. In other words, cardinality specifies the maximum
number of relationships and ordinality specifies the absolute minimum number of
relationships.
1. One to One Relationship:
When a single instance of an entity is associated with a single instance of
another entity then it is called one to one relationship. For example, a person
has only one passport and a passport is given to one person.

2. One to Many Relationship:


When a single instance of an entity is associated with more than one instances
of another entity then it is called one to many relationship. For example – a
customer can place many orders but a order cannot be placed by many
customers.

3. Many to One Relationship:


When more than one instances of an entity is associated with a single instance
of another entity then it is called many to one relationship. For example –
many students can study in a single college but a student cannot study in many
colleges at the same time.

4|Page
5

4. Many to Many Relationship:


When more than one instances of an entity is associated with more than one
instances of another entity then it is called many to many relationship. For
example, a student can be assigned to many projects and a project can be
assigned to many students.

Following figure shows an alternate way to represent cardinality and ordinality


collectively

5|Page
Lab Tasks
Given the two scenarios below, provide an Entity-Relationship Diagram which
clearly shows all the entities and their relationships. Be sure that the structured
constraints are shown. If you make any assumptions other than those described below,
present them in writing. Be sure that these assumptions make sense. Also, make sure
that the assumptions do not contradict any facts (implicit and explicit) given in the
description.
Recommended: Try to use any available data modeling tools for the ER diagrams, such
as IBM Rational Data Architect, ERwin, Microsoft Visio, etc.)

1. GFN Group of Companies have contacted you to design a database system for
them. GFN Group want to launch a Medical Test Lab where the system should be
able to keep track of individual patients and the medical tests performed for that
patient. Moreover they also want to keep track of the doctors who prescribed a
test. Draw an ER Diagram for your proposed model.

2. A database is being constructed to keep track of the teams and games of a sports
league. A team has a number of players, not all of whom participate in each game.
It is desired to keep track of the players participating in each game for each team,
the positions they played in that game, and the result of the game. Choose your
favorite sport (e.g., hockey, cricket, football, baseball, etc.).

3. Modify your solutions to reflect correct cardinalities for Question 1 and Question
2.

6|Page

You might also like