Entity-Relationship Diagrams is a visual tool which is helpful to represent the Entity-Relationship model. It was proposed by Dr. Peter Chen in 1971. It was designed to use E-R model as a conceptual designing approach. It is a collection of basic real-world objects called entities and relationship among entities. The basic reason of using E-R diagrams is that they are translatable into relational tables which allows you to build databases quickly.
The model is based on three basic components
Each of these components are represented by different symbols in an E-R diagram.
An entity is a thing or an object in the real world that is distinguishable from other objects based on the values of the attributes it possesses. For example, if we have three pens, all of them are of same brand, company, type and of same color. These pens will not be considered as entity because we cannot identify any one pen, or we cannot distinguish among all the pens. These pens in this case will be considered as objects but not entity. Moreover, whether to consider any object as an entity also depends on the observer. If the observer is able to identify any object in a group, it is considered as an entity.
Tangible or Concrete Entity: Entities which physically exists in real world. For example, pen, car, bank locker etc.
Intangible or Abstract Entity: Entities which exists logically. For example, Bank account.
Entity set is a collection or a set of same type of entities i.e. they share same properties or attributes. For example, persons having an account in a bank.
Interestingly, we cannot represent an entity in an E-R diagram. Entity set is represented by a rectangle in an E-R diagram. It is a table in a relational model. On the other hand, an entity can be represented by a row or a tuple in a relational model.
Attributes are used to describe the characteristics of entities. For each attribute there is a set of permissible values called domains. In an E-R diagram, attribute is represented by an eclipse or an oval and in relational model, it is represented as a column. For example, every student will have its name, roll_no, age etc. which describes the student.
It is an association between two or more entities of same or different entity set. There is no representation of relationship in an E-R diagram as it is an instance or data. In relational model, a relationship is represented with a row or a tuple.We can identify relationships with verbs or verb phrases. For example, Jack works in Computer Science Department.
We can also have a relationship between two entities of same entity set.
Relationship set is a set of similar type of relationship. In an E-R diagram, relationship set is represented using a diamond and in a relationship model, it is represented either by a table or a column(foreign key). Every relationship type has three components: