Relationship Constraints, ER Notations, Weak Entity, and Extended ER Features
Relationship Constraints
Relationship constraints define how entities participate in a relationship.
They ensure that:
- Data follows real-world rules
- ER diagrams can be correctly converted into tables
There are two main relationship constraints:
- Mapping Cardinality (Cardinality Ratio)
- Participation Constraint
Mapping Cardinality (Cardinality Ratio)
What is Mapping Cardinality?
Mapping cardinality specifies how many entities of one set can be associated with entities of another set through a relationship.
In simple terms:
“How many?”
Types of Mapping Cardinality
1. One-to-One (1 : 1)
In a one-to-one relationship:
- One entity in A is associated with at most one entity in B
- One entity in B is associated with at most one entity in A
Example:
- Citizen has AadhaarCard
Meaning:
- One citizen → one Aadhaar card
- One Aadhaar card → one citizen
2. One-to-Many (1 : N)
In a one-to-many relationship:
- One entity in A can be associated with many entities in B
- Each entity in B is associated with at most one entity in A
Example:
- Citizen has Vea vehicleeaning:
- One citizen can have many vehicles
- Each vehicle belongs to only one citizen
3. Many-to-One (N : 1)
In a many-to-one relationship:
- Many entities in A are associated with one entity in B
This is the reverse of one-to-many.
Example:
- Course taken by Professor
Meaning:
- Many courses can be taught by one professor
- Each course has only one professor
4. Many-to-Many (M : N)
In a many-to-many relationship:
- Many entities in A are associated with many entities in B
Examples:
- Customer buys Product
- Student attends the Cothe course:
- A student can attend many courses
- A course can have many students
Important Note:
Many-to-many relationships cannot be directly implemented in relational databases and must be converted using an intermediate table.
Participation Constraint
What is Participation Constraint?
The participation constraint specifies whether an entity must participate in a relationship or not.
It is also called a minimum cardinality constraint.
Types of Participation Constraint
1. Partial Participation
In partial participation:
- Not all entities participate in the relationship
Example:
- Not every customer borrows a loan
ER Notation:
- Represented using a single line between the entity and the relationship
2. Total Participation
In total participation:
- Every entity must participate in at least one relationship instance
Example:
- The loan must be borrowed by a customer
(A loan cannot exist without a customer)
ER Notation:
- Represented using a double line
Important Rule:
- Weak entities always have total participation
- Strong entities may or may not have total participation
ER Diagram Notations
| Symbol | Meaning |
| Rectangle | Strong Entity |
| Double Rectangle | Weak Entity |
| Ellipse | Attribute |
| Double Ellipse | Multi-valued Attribute |
| Dashed Ellipse | Derived Attribute |
| Underlined Attribute | Primary Key |
| Dashed Underline | Partial Key |
| Diamond | Relationship |
| Double Diamond | Weak (Identifying) Relationship |
| Single Line | Partial Participation |
| Double Line | Total Participation |
Weak Entity
What is a Weak Entity?
A weak entity is an entity that:
- Does not have a complete primary key
- Depends on a strong (owner) entity for identification
Example:
- Payment depends on the loan
- Dependent depends on Employee
Characteristics of Weak Entity
- Has a partial key
- Must participate totally in its identifying relationship
- Cannot exist without its owner entity
Extended ER (EER) Features
When databases become complex, basic ER features are not sufficient.
Extended ER features help model real-world complexity.
Specialization
What is Specialization?
Specialization is the process of splitting an entity set into smaller sub-entity sets based on their features.
- It is a top-down approach
- Uses “is-a” relationship
Example:
- Person → Student, Employee, Customer
(Person is a superclass, others are subclasses)
Why Specialization?
- Some attributes apply only to specific entities
- Helps refine the database design
Generalization
What is Generalization?
Generalization is the reverse of specialization.
- It is a bottom-up approach
- Multiple similar entities are combined into one generalized entity
Example:
- Car, Jeep, Bus → Vehicle
Why Generalization?
- Avoids repetition of common attributes
- Makes the database simpler and cleaner
Attribute Inheritance
In both specialization and generalization:
- Subclasses inherit attributes and relationships of the superclass
Example:
- Student and Employee inherit attributes of Person
Participation Inheritance
If a parent entity participates in a relationship:
- Its child entities automatically participate in that relationship
Aggregation
What is Aggregation?
Aggregation is used when a relationship itself needs to participate in another relationship.
It treats a relationship as a higher-level abstract entity.
Example:
- Employee works_on Project
- Manager supervises (Employee works_on Project)
Aggregation:
- Avoids redundancy
- Models relationships among relationships
Summary
- Mapping cardinality defines how many entities can be associated
- The participation constraint defines whether participation is mandatory
- Weak entities depend on strong entities
- ER notations must be clearly understood
- Extended ER features help model complex databases