0% found this document useful (0 votes)
65 views15 pages

ER Diagram

ER Diagram is a visual representation of data that describes how data is related to each other. It disintegrates data into entities, attributes and relationships between entities. The key components of an ER diagram are entities, attributes, and relationships. Entities can be objects, classes, people or places represented as rectangles. Attributes describe entity properties like name or ID represented as ovals. Relationships show how entities are related using diamonds.
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)
65 views15 pages

ER Diagram

ER Diagram is a visual representation of data that describes how data is related to each other. It disintegrates data into entities, attributes and relationships between entities. The key components of an ER diagram are entities, attributes, and relationships. Entities can be objects, classes, people or places represented as rectangles. Attributes describe entity properties like name or ID represented as ovals. Relationships show how entities are related using diamonds.
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/ 15

ER Diagram is a visual representation of data that describes how data is related to each other.

In ER Model, we disintegrate data into entities, attributes and setup relationships between
entities, all this can be represented visually using the ER diagram.

• ER diagram or Entity Relationship diagram is a conceptual model that gives the


graphical representation of the logical structure of the database.

Components of ER diagram-

An ER diagram is mainly composed of following three components-


1. Entity
2. Attributes
3. Relationship

1. An entity may be any object, class, person or place. In the ER diagram, an


entity can be represented as rectangles. It is also known as strong entity.

. Weak Entity

An entity that depends on another entity called a weak entity.

The weak entity is represented by a double rectangle.

2. Attribute
The attribute is used to describe the property of an entity. Eclipse is used to
represent an attribute.

For example, id, age, contact number, name, etc. can be attributes of a
student.
Types of attibutes

a. Key attribute

Key Attribute –
The attribute which uniquely identifies each entity in the entity set is called key
attribute.For example, Roll_No will be unique for each student. In ER diagram, key

attribute is represented by an oval with underlying lines.


Or

b. Composite Attribute

An attribute that composed of many other attributes is known as a


composite attribute. The composite attribute is represented by an ellipse,
and those ellipses are connected with an ellipse.

c. Multivalued Attribute
An attribute can have more than one value. These attributes are known as a
multivalued attribute. The double oval is used to represent multivalued
attribute.

For example, a student can have more than one phone number.

d. Derived Attribute

An attribute that can be derived from other attribute is known as a derived


attribute. It can be represented by a dashed ellipse.

For example, A person's age changes over time and can be derived from
another attribute like Date of birth.
3. Relationship
A relationship is used to describe the relation between entities. Diamond or
rhombus is used to represent the relationship.

. Strong Relationship Set-

• A strong relationship exists between two strong entity sets.


• It is represented using a diamond symbol.

2. Weak Relationship Set-

• A weak or identifying relationship exists between the strong and weak entity set.
• It is represented using a double diamond symbol.
Enhanced Entity Relationship Model contains all the features of the Entity Relationship
model. In addition to all that, it also contains features of Subclasses, Superclasses and
Inheritance.

Subclasses
A subclass is a class derived from the superclass. It inherits the properties of the
superclass and also contains attributes of its own. An example is:

Car, Truck and Motorcycle are all subclasses of the superclass Vehicle. They all inherit
common attributes from vehicle such as speed, colour etc. while they have different
attributes also.

Superclasses
A superclass is the class from which many subclasses can be created. The subclasses
inherit the characteristics of a superclass. The superclass is also known as the parent
class or base class.
In the above example, Vehicle is the Superclass and its subclasses are Car, Truck and
Motorcycle.
Inheritance
Inheritance is an important feature of Generalization and Specialization. It allows lower-
level entities to inherit the attributes of higher-level entities.

For example, the attributes of a Person class such as name, age, and gender can be
inherited by lower-level entities such as Student or Teacher. Student or Teacher entity nherits
the properties of the superclass and also contains attributes of its own like rollno and empid.

In EER he relationship between sub class and super class is denoted

with symbol.

• For example: Square, Circle, Triangle are the sub class of Shape super class.
Generalization
Generalization is a bottom-up approach in which two lower level entities combine to
form a higher level entity. In generalization, the higher level entity can also combine with
other lower level entities to make further higher level entity.
It's more like Superclass and Subclass system, but the only difference is the approach,
which is bottom-up. Hence, entities are combined to form a more generalised entity, in
other words, sub-classes are combined to form a super-class.
For example, Saving and Current account types entities can be generalised and an
entity with name Account can be created, which covers both.

Specialization
Specialization is opposite to Generalization. It is a top-down approach in which one
higher level entity can be broken down into two lower level entity. In specialization, a
higher level entity may not have any lower-level entity sets, it's possible.
UML Class Diagram
The class diagram depicts a static view of an application.

The main purpose of class diagrams is to build a static view of an application. It is the only
diagram that is widely used for construction, and it can be mapped with object-oriented
languages. It is one of the most popular UML diagrams. Following are the purpose of class
diagrams given below:

1. It analyses and designs a static view of an application.


2. It describes the major responsibilities of a system.
3. It is a base for component and deployment
Vital components of a Class Diagram
Upper Section: The upper section encompasses the name of the class. A class is a
representation of similar objects that shares the same relationships, attributes, operations, and
semantics.

Middle Section: The middle section constitutes the attributes, which describe the quality of the class.
The attributes have the following characteristics:

a. The attributes are written along with its visibility factors, which are public (+), private (-),
protected (#), and package (~).
b. operation name in a class denote the visibility of the attribute and
operation.

c.

o Lower Section: The lower section contain methods or operations. It demonstrates how a
class interacts with data.
Relationships
A relationship can be one of the following types:

o Dependency: A dependency is a semantic relationship between two or more classes


where a change in one class cause changes in another class. It forms a weaker relationship.
In the following example, Student_Name is dependent on the Student_Id.

o Generalization: A generalization is a relationship between a parent class (superclass) and


a child class (subclass). In this, the child class is inherited from the parent class.
For example, The Current Account, Saving Account, and Credit Account are the generalized
form of Bank Account.
o Association: It describes a static or physical connection between two or more objects. It
depicts how many objects are there in the relationship.
For example, a department is associated with the college
o Multiplicity: It defines a specific range of allowable instances of attributes. In case
if a range is not specified, one is considered as a default multiplicity.
o For example, multiple patients are admitted to one hospital.

Cardinality

Cardinality is expressed in terms of:


• one to one

• one to many

• many to many

Aggregation

A special type of association.


• It represents a "part of" relationship.

• Class2 is part of Class1.

Composition

• A special type of aggregation where parts are destroyed when the whole is
destroyed.

• Objects of Class2 live and die with Class1

Realization

you can understand this as the relationship between the interface and the
implementing class.
Class Diagram Example
A class diagram describing the sales order system is given below.

Class Diagram Example: Order System

System

You might also like