0% found this document useful (0 votes)
15 views28 pages

Entity Relationship Modeling

Entity relationship diagram

Uploaded by

chembri022
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)
15 views28 pages

Entity Relationship Modeling

Entity relationship diagram

Uploaded by

chembri022
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/ 28

Entity Relationship Modeling

What is Entity Relationship Modeling?


• ER-Diagram is a pictorial representation of data that describes how data is
communicated and related to each other.
• Any object, such as entities, attributes of an entity, sets of relationship, and
other attributes of relationship, can be characterized with the help of the
ER diagram.
• ER modeling is a top-down structure to database design that begins with
identifying the important data called entities and relationships in
combination with the data that must be characterized in the model.
• Then database model designers can add more details such as the
information they want to hold about the entities and relationships, which
are the attributes and any constraints on the entities, relationships, and
attributes.
Cont.
• ER modeling is an important technique for any database designer to
master and forms the basis of the methodology.
• There are two approaches to drawing E-R diagram:
• The Chen model
• The crow’s foot model
Components of an Entity Relationship diagram
(Chen Model)
Entity: Entity in DBMS can be a real-world object with an existence, For
example, in a School database, the entities can
be Teachers, Students, Courses, etc
• They are represented using the rectangle-shaped box. These
rectangles are named with the entity set they represent
• E.g an entity known as student can be represented as follows
Cont.
Strong Entity
• The strong entity has a primary key. It has weak entities that are
dependent on strong entity. Its existence is not dependent on any
other entity.
• For example, think of a Professor who is supervising students the
professor is a strong entity while students/dependents are weak
entities
Cont.
Weak Entity
• The weak entity in DBMS does not have a primary key and are dependent on the
parent entity. It mainly depends on other entities, for example, dependents of a
professor.

Attribute:
• Entities have attributes, which can be considered as properties describing it.
• They are represented using ellipse-shaped figures
• An entity can have as many attributes as normalization can allow.
Cont.
Example
Name Course

Primary Key
• Every table has one Primary key and cannot have null values. A
primary key can be RegNO, etc. The primary key attribute has an
underline below the name.
RegNO
Cont.
• The diagram below shows an entity known as students with the
following attributes: RegNo, Name, and Course

Name Course RegNO

Student
Cont.
Multivalued Attribute
• An attribute that has multiple values for a single entity at a time is
called a Multivalued Attribute. For example, technical skills of a
student can be programming, web development,

Composite Attribute
• If an attribute has two or more other attributes, then it is called a
Composite Attribute.
• For example, Student Name can be divided as Student First Name,
Student Middle Name, and Student Last Name.
Cont.
• Example of composite attribute
Cont.
Derived Attribute
• As the name suggests, the derived attribute is an attribute whose
value can be calculated from another attribute.
• For example, Student Age can be derived from Date-of-birth of a
student.
Cont.
Relationship
• It is the association between entities
• The types of relationship apply here
• A diamond-shaped box represents relationships. All the entities
(rectangle-shaped) participating in a relationship get connected using
a line.
Cont. (Types of relationships)
There are four types of relationships/cardinality/multiplicity. These are:
• One-to-one: When only a single instance of an entity is associated
with the relationship, it is termed as '1:1'.
• One-to-many: When more than one instance of an entity is related
and linked with a relationship, it is termed as '1:N'.
• Many-to-one: When more than one instance of an entity is linked
with the relationship, it is termed as 'N:1'.
• Many-to-many: When more than one instance of an entity on the left
and more than one instance of an entity on the right can be linked
with the relationship, then it is termed as N:N relationship.
Example
• Think of the following two tables with their respective attributes:
• Department DptCode DptName Location

RegNo Name Course


• Students:

• Their E-R diagram can be presented as shown in the next slide


Crow’s Foot Model
Crow’s Foot Model
Entities
• An entity is a representation of a class of object. It can be a person,
place, thing, etc. Entities usually have attributes that describe them.
• In crow’s foot notation, an entity is represented by a rectangle, with
its name on the top. The name is singular (entity) rather than plural
(entities).
Cont.
Attributes
• An attribute is a property that describes a particular entity.

Cont.
Relationships
• Relationships illustrate the association between two entities.
• They are presented as a straight line. Usually, each relationship has a
name, expressed as a verb, written on the relationship line.
• This describes what kind of relationship connects the objects.
• Note that the mentioned type of relationship is binary.
• In the Entity-Relationship model, representing a ternary or higher
order of relationship is problematic.
Cont.
• Finally, there are four possible edges to the relationship, illustrated
here:
• zero or many
Cont.
• one or many

• one and only one


Cont.
• zero or one
Cont.
Cont.
Cont.
Practice Exercise
• A company keeps records of the products it stores in a warehouse
and the factories that make the products. Each product is identified
by a unique product number and has a name and description. A
product is made by a single factory but a factory can make more than
one product. A factory is recognized by a factory code and has an
address and telephone number. A product can be stored in one or
more warehouses and a warehouse can stock a number of products.
The quantity of a product stored at a warehouse needs to be
recorded. A warehouse is identified by a warehouse code and the
address is also held.
• Identify the entities in the case study. (4marks)
• Draw an ER diagram for the case study. (6marks)
• Show the cardinality and participation constraints in the E-R. (4marks)
Practice Exercise 2
• A Company is organized into departments: Each dept. has a unique
number, unique Name and a particular employee that manages it. We keep
track of the start date when an employee began managing the dept. A
department may have several locations. A department control a number of
projects, each of which has a unique number and a single location. We
store each employees name, Social security Number address, gender and
Date of Birth. An employee is assigned one dept., but may work on several
projects which are not necessarily controlled under the same department.
We keep truck of the current number of hours per week that an employee
work on each project We want to keep track of the dependents of each
employee for insurance purposes. We keep each dependents name,
Gender, Data of Birth and relationship with the employee.
• Required
• Identity all dominant entities. (4 mks)
• Design an ER diagram to represent the case. (8 mks)
The End

Q and A Session

You might also like