Drawing ER and EER Diagrams & Relational Mapping

 

A comprehensive introduction to ER & EER

What are the ER diagrams?

ER diagram is a visual representation of data based on the ER model, and it describes how entities are related to each other in the database.

What are EER diagrams?

EER diagram is a visual representation of data, based on the EER model that is an extension of the original entity-relationship (ERmodel.

Entity

An entity is any singular, identifiable and separate object. It refers to individuals, organizations, systems, bits of data or even distinct system components that are considered significant in and of themselves. For example, People, Property, Organizations, Agreements and, etc. In the ER diagram, the entity is represented by a rectangle.

Attributes

Attributes are the properties that define the entity type. For example, Roll_No, Name, DOB, Age, Address, Mobile_No are the attributes that define entity type Student. In the ER diagram, the attribute is represented by an oval.

Relationships

relationship is an association that describes the interaction between entities.

Cardinality

Cardinality refers to the maximum number of times an instance in one entity can relate to instances of another entity. There are three types of cardinalities.

  1. one to one (1 to 1)
  2. one to many(1 to N)
  3. many to many (M to N)

Participation

Participation constraint specifies the existence of an entity when it is related to another entity in a relationship type. There are two types. Partial and Total participation.

  1. Requirements Analysis- Understand the data problem through user interviews, forms, reports, observation and etc.
  2. Component design stage- Create a data model that is a graphical representation of what will be finally will be implemented.
  3. Implementation stage- Actual development of the database which leads to database actually being used in the real environment.
  1. Conceptual design
  2. Logical design
  3. Physical design
  • Write all entities in the singular form
  • Write all relationships in a singular form.
  • Write all attributes in the singular form.
  • If you want to separate words use underscore mark.

Drawing ER and EER diagrams

Below points show how to go about creating an ER diagram.

  1. Identify all the entities in the system. An entity should appear only once in a particular diagram. Create rectangles for all entities and name them properly.
  2. Identify relationships between entities. Connect them using a line and add a diamond in the middle describing the relationship.
  3. Add attributes for entities. Give meaningful attribute names so they can be understood easily.
  4. Mark the cardinalities and participation between the entities.

Now let’s see how to draw EER diagrams.

Here we just need to add a few things to above.

Total Participation
Partial Participation

Now it ends, after following all the above steps you can come up with your ER and EER diagrams.😍

Benefits of ER and EER diagrams.

  • Easy to understand and does not require a person to undergo extensive recently training to be able to work with it and accurately.
  • Readily translatable to relational tables which can be used to quickly build databases
  • Can directly be used by database developers as the blueprint for implementing databases in specific software application
  • It can be applied in other contexts such as describing the different relationships and operations within an organization.

Mapping ER and EER diagrams into relational schemas

First I’ll tell you how to map the ER diagram into a relational schema.

Mapping ER diagrams into relational schemas

Follow the steps one by one to get it done.🤞

  1. Mapping strong entities.
  2. Mapping weak entities.
  3. Map binary one-to-one relations.
  4. Map binary one-to-many relations
  5. Map binary many-to-many relations.
  6. Map multivalued attributes.
  7. Map N-ary relations

1. Mapping strong entities.

2. Mapping weak entities.

3. Map binary one to one relations.

Let’s assume that the relationship between CUSTOMER and CARD is one to one.

4. Map binary one-to-many relations

5. Map binary many to many relations.

6. Map multivalued attributes.

7. Map N-ary relations.

First, let us consider unary relationships.

If there are more than three entities for a relationship you have to make a new relation table and put all primary keys of connected entities and all attributes in the relationship. And in the end, you have to map them as shown below.

👍 That’s how we map ER diagrams into relational schemas.

Now let us see how to map EER diagrams.

Mapping EER diagrams into relational schemas.

Let us go through the following diagram.

👍 That’s how we map EER diagrams into relational schemas.

Try more and more to come up with the best.

Comments