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

Lesson02 ER Modelling

Uploaded by

mwangibrian1293
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)
11 views4 pages

Lesson02 ER Modelling

Uploaded by

mwangibrian1293
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

2 Lesson 2: ER-Modeling

Relational Model (RM) represents the database as a collection of relations. A relation is nothing but
a table of values. Every row in the table represents a collection of related data values. These rows in
the table denote a real-world entity or relationship.

Entity Relationship Modeling (ER Modeling) is a graphical approach to database design. It is a high-
level data model that defines data elements and their relationship for a specified software system. An
ER model is used to represent real-world objects.

ER Modeling helps you to analyze data requirements systematically to produce a well-designed


database. Thus, it is always considered a best practice to complete ER modeling before implementing
a database.

2.1 Relational Model Concepts

An entity is object, or component of data, that is easily identifiable. It is object in real world that is
distinguishable from the surrounding environment. It can be an object with either physical
existence (eg. student, patient, customer, products) or conceptual existence (eg. orders,
treatments, registrations,). For example, in a university database, students, lecturers,
programs, and courses offered can be considered as entities. All these entities have some
attributes that describe them.

Attribute: Each column in a table is an attribute. Attributes are the properties which define a
relation. e.g. StudentId, StudentName, email etc. define the relation students

Reading Assignment: Read about the different types of attributes and suggest valid
examples

Tables – In the Relational model the, relations are saved in the table format. It is stored along with its
entities. A table has two properties rows and columns. Rows represent records and columns
represent attributes.

Tuple – It is nothing but a single row of a table, which contains a single record.

Relation Schema: A relation schema represents the name of the relation with its attributes.

Degree: The total number of attributes which in the relation is called the degree of the relation.

Cardinality: Total number of rows present in the table.

Column: The column represents the set of values for a specific attribute.

Relation instance – Relation instance is a finite set of tuples in the RDBMS system. Relation
instances never have duplicate tuples.

Relation key - Every row has one, two or multiple attributes, which is called relation key.

Reading Assignment: Distinguish between a superkey, candidate key, and a primary key

Attribute domain – Every attribute has some pre-defined value and scope which is known as
attribute domain

1
Relationship - is used to describe the association between entities. The number of participating
entities in a relationship defines the degree of the relationship.

Reading Assignment: Read about 1:1, 1:m, m:1, and m:m relationships

2.2 ER Modeling Symbols and Notations

ER Modelling contains three basic symbols which are rectangle, oval and diamond to represent
relationships between elements, entities and attributes. The following are the main components and
its symbols in ER Diagrams:

i. Rectangles: This Entity Relationship Diagram symbol represents entities


ii. Ellipses: Symbol represent attributes
iii. Diamonds: This symbol represents relationship types
iv. Lines: It links attributes to entity types and entity types with other relationship types
v. Primary key: attributes are underlined
vi. Double Ellipses: Represent multi-valued attributes

Reading Assignment: Read about weak relationships, weak entities, and Multivalued attributes

2.3 Components of the ER Diagram

This model is based on three basic concepts:

 Entities
 Attributes
 Relationships

2.4 Advantages of using Relational Model


i. Simplicity: A Relational data model in DBMS is simpler than the hierarchical and
network model.
ii. Structural Independence: The relational database is only concerned with data and
not with a structure. This can improve the performance of the model.
iii. Easy to use: The Relational model in DBMS is easy as tables consisting of rows and
columns are quite natural and simple to understand
iv. Query capability: It makes possible for a high-level query language like SQL to
avoid complex database navigation.

2
v. Data independence: The Structure of Relational database can be changed without
having to change any application.
vi. Scalable: Regarding a number of records, or rows, and the number of fields, a
database should be enlarged to enhance its usability.

2.5 Disadvantages of using Relational Model


i. Few relational databases have limits on field lengths which can't be exceeded.
ii. Relational databases can sometimes become complex as the amount of data grows,
and the relations between pieces of data become more complicated.
iii. Complex relational database systems may lead to isolated es where the information
cannot be shared from one system to another.

2.6 Best Practices for creating a Relational Model

 Data need to be represented as a collection of relations


 Each relation should be depicted clearly in the table
 Rows should contain data about instances of an entity
 Columns must contain data about attributes of the entity
 Cells of the table should hold a single value
 Each column should be given a unique name
 No two rows can be identical
 The values of an attribute should be from the same domain
Example 1: Programs and Students
Consider the following proposition and develop an appropriate ER Model.

“Programs have Students”

To develop an ER model for the above requirements, the following steps are taken.
1. Identify all the entities from the given requirement
2. Identify the relationship between the entities
3. Identify the cardinality of the relationships
4. Identify the attributes of each entity
5. Create a sketch of the model using a pen and paper

Assignment 1:
Consider a basic requirement using the following sentence.

“In a hospital there are doctors who treat patients. The treatment may entail the patients being
prescribed one or more drugs”

Follow the same steps above / as demonstrated during the Lab session to draw an ER Model.

Assignment 2:
Consider a basic requirement using the following sentence.

3
“In MUST there are drivers who are assigned to drive vehicles. ”

Follow the same steps above / as demonstrated during the Lab session to draw an ER Model.

Assignment 3: MyLibSeat
MyLibSeat is a small application that utilizes database to enable the students of XYZ college to
reserve a library seat, for a session lasting a couple of hours. The two major entities in this case
are students—students who reserve library seats; and library seats —seats in the college library
inventory. In this problem we need to know what seats are reserved by which students on a given
day, or better still, a given hour. Thus, the verb “reserves” would obviously represent an
important relationship here.

The attributes of the student entity are:

regno each student is assigned a unique ID


name the student name
phone the phone contact for a student
email the email contact for a student
credit the max number of hours that a student can reserve seats in a
day
Attributes of the seat entity

Seatno each seat is assigned a unique ID (painted at the back of the seat)
seat_type The type of the seat (also painted on the bow)
seat_color The color of the seat
Note:

A student can make many reservations, but each reservation involves only a single student.
Similarly, a seat can be allocated to many reservations, but only one seat is allocated to
each particular reservation.

Required:

Draw an ER-Model that captures the above information.

You might also like