Information Technology
Data ModelingA Look at the Entity-Relationship
Entity-Relationship
The Entity-Relationship or E-R is a model which deals with real world entities, it includes a set of objects and the relationships among them. Entity is an object that exists and is easily distinguishable from others. Like people, they can easily be distinguished from others through various methods; for instance you can distinguish people from one another by social security numbers.
Also an entity can be concrete, like a book, person, or place, while it can also be abstract, like a holiday for example. Now an entity set is a set of entities that share something, like multiple holders of a bank account, those people would be considered an entity set. Also entity sets do not need to be disjoint.
Here is an example, the entity set employee (all employees of a bank) and the entity set customer (all customers of the bank) may have members in common. Such as an employee or employees may also be members of the bank. This puts them into both sets.
We must keep in mind that an entity or entity set is defined by a set of attributes. An attribute is a function which maps an entity set into a domain. Every entity is described by a set of (attribute, data value) pairs. There is one pair for each attribute of the entity set.
To illustrate in simpler terms, consider the following.
- A bank has employees, and customers.
- Employees are an entity set defined by employee numbers.
- Customers are an entity set defined by account numbers.
- Employees can be customers as well, and will have possession of both employee numbers and account numbers.
Relationships and Relationship Sets
A relationship, is an association between several entities. A relationship set is much like the others but it is a set of entities that are associated through one or more aspects. This is where relationship and relationship set start to differ because basically it is a mathematical relation. Consider the following:
If the equation
expresses different entity sets, then a relationship set R, is a subset of
![]()
Where
would express the actual relationship. Though it appears to be little complicated, with some practice it can be no more challenging then reading a simple sentence.
One should remember that the role of an entity is the function it has in a relationship. Consider an example, the relationship “works-for” could be ordered pairs of different employee entities or entity sets. The first employee entity takes the role of a manager or supervisor, where as the other one will take on the role of worker or associate.
Relationships can also have descriptive attributes. This can be seen in the example of a date (as in the last date of access to an account), this date is an attribute of a customer account relationship set.
Attributes
A particular set of entities and the relationships between them can be defined in a number of ways. The differentiating factor is how you deal with the attributes. Consider a set of employees as an entity, this time let us say that the set attributes are employee name and phone number.
In some instances the phone number should be considered an entity alone, with its own attributes being the location and uniqueness of the number it is self. Now we have two entity sets, and the relationship between them being through the attribute of the phone number. This defines the association, not only between the employees but also between the employee phone numbers. This new definition allows us to more accurately reflect the real world.
Basically what constitutes an entity and what constitutes an attribute depends largely on the structure of the situation that is being modeled, as well as the semantics associated with the attributes in question.
Let us now look at an example of the entity-relationship graph.
We can easily express the logical structure of a database in picture with an entity relationship diagram. Yet this is only possible when we keep in mind what components are involved in creating this type of model.
The vital components of an entity relationship model include:
* Rectangles, representing entity sets.* Ellipses, representing attributes.* Diamonds, representing relationship sets.* Lines’, linking attributes to entity sets and entity sets to relationship sets.
Below diagram illustrates how an Entity-Relationship models work.

