What is ER Diagram
What is ER Diagram
An entity relationship diagram (ERD) shows the relationships of entity sets stored in a database. An entity in this context is an object, a component of data. An entity set is a collection of similar entities. These entities can have attributes that define its properties.
A model that represents system data by entity and relationship sets is called E-R (Entity-Relationship) diagram. It is a detailed logical representation of the data for an organization. The entity-relationship (E-R) diagram is based on a perception of a real world which consists of a set of basic objects.
The ERD is graphical data modeling tool. It is based on a perception of a real worker that consists of a collection of basic objects , called entities , and of relation among these objects. While DFD captures the data and its relationship.
E-R diagram is consists of three main constructs, i.e. Data Entities, Relationships and their Associated Attributes.
Data Entities
Entities: An entity is a person, place, thing or event of interest to the organization and about which data are captured, stored or processed. For example, an employee is an entity.
Relationship
Relationship: An association of several entities in an entity-relationship diagram is called relationship. There are three types of relationship exist among entities. These are:
- One-to-One
- One-to-Many
- Many-to-Many
Relationship
Attributes: Each entity type has a set of attributes associates with it. An attribute is a property of characteristics of an entity that is of interest to the organization. I use an initial Capital Letters, followed by Lowercase Letters in naming an attribute. If an entity is something about which I want to store data, then I need to identify what specific pieces of data I want to store about each instance of a given entity. I call these pieces as data attributes.
ERD is built up by the following components
- Rectangle: Which represent entity sets
- Ellipses: Which represent attributes
- Diamonds: Which represent relationship among entity sets
- Lines: Which like attributes to entity sets customer set to relationship
Attribute(s)
Attributes are the properties which define the entity type. For example, Roll_No, Name, DOB, Age, Address, Mobile_No are the attributes which defines entity type Student. In ER diagram, attribute is represented by an oval.
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.
Composite Attribute
An attribute composed of many other attribute is called as composite attribute. For example, Address attribute of student Entity type consists of Street, City, State, and Country. In ER diagram, composite attribute is represented by an oval comprising of ovals.
Multivalued Attribute
An attribute consisting more than one value for a given entity. For example, Phone_No (can be more than one for a given student). In ER diagram, multivalued attribute is represented by double oval.
Derived Attribute
An attribute which can be derived from other attributes of the entity type is known as derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, derived attribute is represented by dashed oval.
Common Entity Relationship Diagram Symbols
An ER diagram is a means of visualizing how the information a system produces is related. There are five main components of an ERD:
Entities
Entities, which are represented by rectangles. An entity is an object or concept about which you want to store information.
Week Entities
A weak entity is an entity that must defined by a foreign key relationship with another entity as it cannot be uniquely identified by its own attributes alone.
Action
Actions, which are represented by diamond shapes, show how two entities share information in the database.
Atributes
Attributes, which are represented by ovals. A key attribute is the unique, distinguishing characteristic of the entity. For example, an employee's social security number might be the employee's key attribute. Attribute - ERD SymbolA multivalued attribute can have more than one value. For example, an employee entity can have multiple skill values.
Derived Attributes
A derived attribute is based on another attribute. For example, an employee's monthly salary is based on the employee's annual salary.
Connection Lines
Connecting lines, solid lines that connect attributes to show the relationships of entities in the diagram.
Naming Convention in ER Diagram
In our ER diagrams, we will use the convention that entity type and relationship type names are uppercase letters, attribute names have their initial letter capitalized, and role names are lowercase letters.