Entity, Relationship and Attribute Types in DBMS
In this lesson: Entity types, relationship types and attribute types — simple, composite, derived, multivalued, key — with diagrams.
The three building blocks
The ER model is built from three things: entities (the objects), attributes (their details) and relationships (how they connect). Each of these comes in different types, and knowing them helps you model real situations accurately.
Strong and weak entities
- Strong entity — has its own key and stands alone (Student, Book). Drawn as a single rectangle.
- Weak entity — has no key of its own; it depends on a strong entity to be identified (a Dependent tied to an Employee). Drawn as a double rectangle.
A weak entity needs an identifying relationship (double diamond) to its owning strong entity.
Types of attributes
| Type | Meaning | Example |
|---|---|---|
| Simple | Atomic, cannot split | age |
| Composite | Made of parts | full name (first + last) |
| Single-valued | One value only | date of birth |
| Multivalued | Many values | phone numbers |
| Derived | Calculated from others | age from DOB |
| Key | Uniquely identifies | roll number |
Types of relationships
By cardinality — how many relate to how many:
- One-to-one (1:1) — a person and their passport.
- One-to-many (1:N) — a department and its students.
- Many-to-many (M:N) — students and courses.
Cardinality decides where foreign keys go, and whether a link table is needed (for M:N).
Degree of a relationship
- Unary — one entity related to itself (an Employee "manages" another Employee).
- Binary — two entities (Student "enrolls in" Course). The most common.
- Ternary — three entities in one relationship.
Degree counts how many entities take part; cardinality counts how many instances.
Putting it together
Consider a library:
- Entities: Member (strong), Book (strong).
- Attributes: Member has id (key), name, and phone numbers (multivalued).
- Relationship: Member "borrows" Book — a many-to-many binary relationship.
This maps to Member and Book tables plus a link table for borrowing.
Common mistakes
- Treating a weak entity as strong. It has no key of its own; link it to its owner.
- Storing a derived attribute. Often better to calculate it than store it.
- Confusing degree and cardinality. Degree = number of entities; cardinality = number of instances.
- Modelling many-to-many without a link table. M:N needs one.
Summary
- Entities can be strong (own key) or weak (dependent).
- Attributes: simple, composite, single/multivalued, derived, key.
- Relationships by cardinality: 1:1, 1:N, M:N.
- Degree is how many entities join a relationship (unary, binary, ternary).
- These types together let you model any real situation.
Next, learn the overall ER model, or the drawing symbols in ER diagram symbols.
