Entity-Relationship Model
The Entity-Relationship (ER) model, proposed by Peter Chen in 1976, is a widely used conceptual data model that describes the real-world domain of a database in terms of entities, relationships, and attributes. The output of ER modelling is an ER diagram that serves as a blueprint for the database schema.
Entities and Attributes
An entity is a distinguishable object in the domain, such as a student, a course, or a transaction. Entities of the same type form an entity set. Entities have attributes describing their properties. Attributes may be simple (atomic) or composite (made up of sub-parts), single-valued or multi-valued, stored or derived (computed from other attributes).
Keys
A key is a minimal set of attributes uniquely identifying entities of an entity set. A super key is any attribute set that uniquely identifies entities; a candidate key is a minimal super key; the primary key is the candidate key chosen by the designer. Keys are the foundation of referential integrity and query performance.
Relationships
A relationship associates two or more entities. The degree of a relationship is the number of participating entity sets: binary relationships (degree 2) are most common, but ternary and higher-degree relationships occur. The cardinality of a binary relationship—one-to-one, one-to-many, many-to-many—specifies how many entities can participate. Participation may be total (every entity participates) or partial.
Weak Entity Sets
A weak entity set is an entity set that cannot be uniquely identified by its own attributes; its identity depends on a relationship with a strong (identifying) entity set. The weak entity's partial key combined with the strong entity's primary key forms its identifier. Weak entities model parts, line items, and other dependent concepts elegantly.
ER Diagram Notation
ER diagrams use rectangles for entity sets, diamonds for relationship sets, ovals for attributes, and lines to connect them. Underlined attributes are primary keys; double-lined rectangles mark weak entity sets. Cardinality is indicated by labels near the relationship or by Chen, crow's foot, or min-max notations.
Extended ER Features
The Extended ER (EER) model adds specialization, generalization, inheritance, and aggregation. Specialization divides an entity set into more specific subsets (a Person specializes into Student and Employee). Generalization is the reverse operation. Aggregation treats a relationship as a higher-level entity so that it can participate in further relationships.
Mapping ER to Relational Schema
ER diagrams are mapped to relational tables by systematic rules: each strong entity becomes a table; multi-valued attributes become separate tables; many-to-many relationships become tables; one-to-many relationships may use a foreign key in the many side; weak entity sets use composite primary keys. The mapping produces a starting schema that can then be normalized.
Design Guidelines
Good ER design avoids redundancy, captures all business rules as constraints, and uses appropriate cardinality. Designers should prefer relationships over duplicated attributes, treat time-dependent data carefully, and validate models with stakeholders.
Summary
The ER model is a conceptual tool that lets designers reason about data at a high level before committing to an implementation. Entities, relationships, and attributes are the basic vocabulary, while keys, participation constraints, and EER features capture the more subtle structure of real systems.