Entity Relationship Model: Attributes, Entities, and Relationships
ER Model: Attributes, Entities, and Relationships
Attribute Definitions
- Composite Attribute: An attribute composed of multiple components. Example: Full Name (First Name, Last Name).
- Derived Attribute: An attribute calculated from other attributes. Example: Age (from Date of Birth).
- Single-Valued Attribute: An attribute with only one value. Example: Social Security Number.
- Multivalued Attribute: An attribute with multiple values. Example: Phone Numbers.
- Simple Attribute: An attribute that cannot be divided. Example: Gender.
Entity Definitions
- Strong Entity: An entity that exists independently. Example: Student.
- Weak Entity: An entity dependent on a strong entity. Example: Dependent (relies on Employee).
Relationship Definitions
- Strong Relationship: A relationship between independent entities. Example: Professor teaches Courses.
- Weak Relationship: A relationship where a weak entity depends on a strong entity. Example: Dependent is associated with Employee.
- Recursive Relationship: An entity related to itself. Example: Employee manages another Employee.
Weak Entity Conditions
Existence Dependency: A weak entity cannot exist without a strong entity.
Identification Dependency: A weak entity uses a foreign key from the strong entity as part of its primary key.
Relationship Properties
Connectivity: Type of relationship (1:1, 1:N). Example: Student enrolls in multiple Courses (1:N).
Cardinality: Number of instances related to another. Example: Each Course has 10-100 Students.
Design Conflicts
Data Redundancy Minimization vs. Speed Optimization: Normalization reduces redundancy but can slow down queries due to joins.
Entity Supertypes and Subtypes
Vehicle is the supertype.
- Supertype: Vehicle (Vehicle ID, Make, Model, Year).
- Subtypes: Car (Number of Doors, Trunk Size), Truck (Payload Capacity, Number of Axles).
Subtype Discriminator: Vehicle Type (e.g., Car or Truck).
Disjoint Subtypes: A vehicle cannot be both a Car and a Truck.
Total Completeness: Every Vehicle must be either a Car or a Truck.
Fan Trap Example
Incorrect ERD: Department connects to Manager and Project without a direct relationship between Manager and Project.
Explanation: No direct connection to determine which Manager is responsible for which Project.
Corrected ERD: Create a direct relationship between Manager and Project.
Entity Clusters
Definition: A group of entities and their relationships treated as a single abstract entity.
Advantage: Simplifies large ER diagrams by reducing visual clutter.