Entity Relationship Model (E-R Model)
The process of database design is an iterative process. The ER Model is used at the conceptual design stage of the database design.ER diagram is used to represent this conceptual design. The requirement analysis is modeled in this conceptual design. The ER model is very expressive so that people can easily understand the requirement. The data modeler prepares the ER diagram and is verified with the functional domain experts to ensure that all the requirements are properly incorporated in the conceptual design. The process is repeated until the end users and designers agree that the E-R diagram is a fair representation of the requirement. We can easily map an ER diagram to a relational schema.
The basic constructs of ER Model are Entity, Attributes and Relationships. An Entity is an object that exist in the real world and is distinguishable from other entities.
- Conceptual Design
- ER Diagram
An entity is a thing or object in the real world that is distinguishable from all other objects. For example 'Person' in an organization is an entity. An entity has a set of properties. At the E-R modeling level an entity actually refers to an entity set. In other words, entity in ER model corresponds to a table.
An entity may be concrete such as a person, book etc or may be abstract such as account,loan etc. The ER model refers to a specific table row as an entity instance or entity occurrence. Collection of similar entities (Entity Set) often corresponds to a table. Each entity set has a key.All entities in an entity set have the same set of attributes. Thus entity set is a set of entities of the same type that share the same properties or attributes. An entity is represented by a rectangle containing the entity name, which is a noun usually written in capital letters.
An entity is represented by a set of attributes. It corresponds to a field in a table.For each attribute there is a set of permitted values called the domain or value set of the attribute. Attributes are represented by ovals and are connected to the entity with a line. Each oval contains the name of the attribute it represents.
A relationship describes an association among entities. In ER model the association among entities is described as one-to-one, one-to-many, many-to-many. Relationships are represented by a diamond connected to the related entities. The relationship name (an active or passive verb), is written inside the diamond.
Extended ER Features
- Attribute Inheritance
The process of designating sub groupings with in an entity set is called specialization.We use IS A relationship to represent specialization.IS A relationship may also be referred as super class-subclass relationship
Example: Person IS A Employee
Person IS A Customer
Employee IS A Manager
Here the design process take place in bottom up manner.Multiple entity sets are synthesized into a higher level entity set on the basis of common features.
Example: Employee and Customer entities can be synthesized into a higher level entity Person.
The attributes of higher level entity set are inherited by lower level entity set.
Aggregation is an abstraction in which relationship sets are treated as higher level entity sets. Here a relationship set is embedded inside an entity set, and these entity sets can participate in relationships.