- Introduced by
- Peter P.-S. Chen
- Year
- 1976
- Type
- Data modeling approach
- Family
- Conceptual Data Modeling
What does it do?
Entity-Relationship (ER) modeling is a conceptual approach to database design in which the data of a domain is described as entities, their attributes, and the relationships between them.
Peter P.-S. Chen introduced the model in 1976, together with a diagrammatic technique for recording these structures. The resulting conceptual model is then translated into a logical relational schema.
The intuition behind the method
The method asks the designer to describe data in terms of things (entities), the properties that describe them (attributes), and the connections between things (relationships), before deciding on tables. Because this description does not depend on a particular implementation, domain experts can check it against their own understanding of the business. Mistakes in how things are grouped or connected are easier to correct at this stage than after keys and tables have been defined.
History
Peter P.-S. Chen published the entity-relationship model in 1976 in ACM Transactions on Database Systems. The paper proposed incorporating semantic information about the real world into database design, introduced a diagrammatic technique for it, and presented the model as a basis for unifying the network, relational, and entity set views of data. Later work extended the basic model. The Extended Entity-Relationship (EER) model adds constructs such as generalization, specialization, and aggregation. Teorey, Yang, and Fry (1989) developed a logical design methodology for relational databases using the extended entity-relationship model.
When to use it
Choose ER modeling at the conceptual stage of relational database design, when the entities and relationships of the domain are still being agreed and must be reviewed with people who do not write SQL. It suits systems with many interacting entity types and the documentation of an existing database whose structure is no longer clear. The approach assumes that entity types and relationships are reasonably well defined and stable; if requirements are still vague, gather them first. Do not rely on ER diagrams to settle performance, indexing, or denormalization questions, which the conceptual model does not address. For analysing an existing table design for redundancy, database normalization is the more direct tool.
Limitations and considerations
- The conceptual model does not capture performance requirements, access paths, or denormalization choices; these must be decided at the logical and physical design stages.
- Diagrams become hard to read as the number of entities and relationships grows, and large models usually have to be split into sub-diagrams.
- Extended constructs for generalization and aggregation, and the symbols used for participation, are not drawn uniformly across tools and texts. Chen's notation and crow's-foot notation differ, so diagrams from different sources may not be read identically.
- The basic notation does not express business rules beyond cardinality, such as conditions on attribute values, so these need separate documentation.
- Cardinality labels alone do not state participation constraints, that is, whether every instance must take part in a relationship (total participation) or need not (partial participation), or the minimum and maximum number of links. Weak entities, whose identity depends on an owner entity, are drawn with additional notation that varies between sources.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Separates the meaning of the data (which entities exist and how they relate) from the storage decisions made later, so the conceptual design can be checked before any tables are chosen.
- Cardinality labels make one-to-one, one-to-many, and many-to-many constraints between entities explicit in the diagram, where they are easy to miss in prose requirements.
- The diagram gives non-specialists a shared picture of the domain, and the entity and relationship decisions it records can be reviewed later as a design record.
- Chen's 1976 paper presents the model as a basis for relating the network, relational, and entity set views of data, so one conceptual model can be mapped to more than one implementation style.
Applications
- Hospital record systems, where patients, treatments, and departments are linked by one-to-many and many-to-many relationships that should be stated before tables are designed.
- University enrollment, where the many-to-many link between students and courses is resolved through an enrollment entity, and course prerequisites form a relationship between courses themselves.
- Retail catalogues, where products are grouped into categories and orders associate customers with products through a many-to-many relationship.
- Social network data, where users are related to one another by connections and to content by interactions, each of which can be modelled as a relationship type.
How it works
How it works
Gather requirements from domain experts and users to identify which entities the system must track and what information must be held about each.
For each candidate entity, state what it represents and list the attributes that describe it. Check that every entity has an identity of its own, so that attributes are not mistaken for entities.
Identify the relationships between entities and record their cardinality as one-to-one, one-to-many, or many-to-many, because this determines how each relationship is later mapped to tables.
Draw the ER diagram, showing entities as rectangles, attributes as ovals, and relationships as diamonds, with cardinality labels on the relationship links.
Logical design stage: translate the finished conceptual model into a relational schema. Entities become tables, one-to-many relationships are usually implemented as foreign keys, and many-to-many relationships are implemented with junction tables.
Common pitfalls
- Modelling an attribute as an entity, or an entity as an attribute, which hides the identity that distinguishes entities. Check whether each candidate entity has an identity of its own.
- Placing cardinality labels on the wrong side of a relationship, which reverses the meaning of a one-to-many link. Read each label back as a sentence before finalising the diagram.
- Drawing every attribute in the diagram too early, which obscures the essential entities. Attributes not needed for the current analysis can be kept in a data dictionary.
- Leaving many-to-many relationships unresolved in the conceptual model, so that the junction structure needed to implement them is discovered late, when the schema is built.
Frequently asked questions
What is the difference between an entity and an attribute?
An entity is an independent thing with its own identity (e.g., Student), while an attribute is a property that describes an entity (e.g., StudentName, DateOfBirth). Attributes depend on their entity and have no existence without it.
How do I handle many-to-many relationships in a relational database?
Create a junction table (also called a bridge table) that contains foreign keys to both entities. For example, a Student-Course many-to-many relationship becomes a StudentEnrollment table with StudentID and CourseID.
When should I use generalization/specialization (inheritance) in ER models?
Use generalization when you have entities that share common attributes and relationships but also have type-specific attributes. For example, Employee is a generalization of FullTimeEmployee and ContractEmployee.
Should I include all possible attributes in the ER diagram?
No. Include only attributes essential for the current analysis. Keep the diagram at an appropriate level of abstraction; detailed attributes can be documented separately in a data dictionary.
Related methods
Sources
Chen, P. P.-S. (1976). The entity-relationship model: Toward a unified view of data. ACM Transactions on Database Systems, 1(1), 9-36.
Open DOI referenceChen, P. P.-S. (1977). English sentence structure and entity-relationship diagrams. New York, NY: Elsevier North-Holland.
Open publication referenceTeorey, T. J., Yang, D., & Fry, J. P. (1989). A logical design methodology for relational databases using the extended entity-relationship model. ACM Computing Surveys, 18(2), 197-222.
Open publication reference