An Entity Relationship Model (ER Model) is a detailed logical representation of the data for an organization. The ER model is expressed in turns of entities, the relationships among those entities, and the attributes of both the entities and their relationship. An ER model is normally expressed as an entity-relationship diagram (ER diagram), which is a graphical representation of an ER model.

ER Model Constructs:

The basic constructs of the entity-relationship model are entities, relationships, and attributes.

i. Entities: An entity is a person, places, object, event, or concept in the user environment about which the organization wishes to maintain data.

Entity types:

  • Person: STUDENT, EMPLOYEE, PATIENT, etc.
  • Places: CITY, STATE, COUNTRY, etc.
  • Object: MACHINE, BUILDING, AUTOMOBILE, etc.
  • Event: SALE, BAY, REGISTRATION, etc.
  • Concept: ACCOUNT, COURSE, etc.

Strong vs Week Entity Type: A strong entity type is one that exists independently of other entity types, examples include; STUDENT, EMPLOYEE, and COURSE.

In contrast, a weak entity type is an entity type whose existence depends on some other entity types.

ii. Attributes: Each entity type has a set of attributes associated with it. An attribute is a property or characteristic of an entity type. Following are some typical entity types and their associated attributes:-

  • STUDENT: Student_ID, Student_Name, Address, Phone_Number, Major, etc.
  • EMPLOYEE: Employee_ID, Employee_Name, Address, Skill, etc.

Simple VS Composite Attributes: A composite attribute is an attribute that can be broken down into component parts. The most common example is Address which can usually be broken down into the following components:

A simple attribute is an attribute that can’t be broken down into smaller components. For examples; STUDENT_ID, Color, Weight, etc.

Single-valued VS multi-valued Attributes: The attributes that hold a single value are single-valued. The majority of attributes are single-valued. For examples:- Student_ID, Course_Number etc.

A multi-valued attribute is an attribute that may take on more than one value for a given entity. For examples; The EMPLOYEE entity type has an attribute name skill, whose values record the skill/ skills for that employee. Of course, some employees may have more than one skill. (such as SQL, COBOL, C++, etc.)

Stored VS Derived Attributes: A derived attribute is an attribute whose values can be calculated from related attribute values. For examples: the ‘EMPLOYEE’ entity has an attribute “Age” which indicates the employee’s age. If the ‘EMPLOYEE’ entity set also has an attribute “Date of Birth”. We can say calculate “Age” from the “Date of Birth” from the current date.

iii. Relationship: A relationship is an association among several entities. The association between entity sets is referred to as participation.

In the above example, there are two entity types: STUDENT & COURSE that participate in the relationship name complete.

Degree of Relationships: The degree of a relationship is the number of entity types that participate in that relationship. The three most common relationships in ER models are:

a) Unary Relationship: A unary relationship is a relationship between the instance of a single entity type.

b) Binary Relationship: A binary relationship is a relationship between the instances of two entity types. It is the most common type of relationship in data modeling.

c) Ternary Relationship: A ternary relationship is a simultaneous relationship among the instances of three entity types.

Sample of ER Diagram: The logical structure of a database can be expressed graphically by an ER diagram. ER diagram consists of the following components:

  • The department of ISLM has a number of employees the identifier for an Employee is EPM_ID, EMP_Name, Skill, Address, etc.
  • Each employee is assigned to a particular section. The identifier for a section is Section_Name, Section_ID, etc.
  • A number of student studies in the department. The identifier for a student is Student_Name, Student_ID, Year, Age, Address, Class, Date of Birth, Hobby, etc.
  • A number of teachers work for the department. The identifier for the teacher is Teacher_Name, Teacher_ID, Degree, Designation, etc.
  • Students register courses for each year. The identifier for the course is Course_Title, Course_ID, Credit, Duration, etc.
  • Each course requires a number of course materials. The identifier for the course is Materials_Name, Materials_ID, Materials_Type, etc.
  • Students submit scholarship applications. The identifier for scholarship application is App_ID, App_Dare, Qualification, etc.