Modeling Data in the Organization - Detailed Notes
Entity-Relationship (E-R) Model
Represents logical data structures for organizations using:
Entities: Categories of data (e.g., customers, orders).
Relationships: Associations between entities (e.g., customers place orders).
E-R Diagram (ERD):
A graphical tool that visually represents entity-relationship models.
Serves as a blueprint for developers.
Components of E-R Diagram (ERD)
Entities:
Description of objects that need to be recorded (e.g., EMPLOYEE).
Instance: A single occurrence of an entity (e.g., specific employee).
Attributes:
Properties or characteristics of an entity (e.g., name, address).
Types: Simple vs Composite, Single-Valued vs Multivalued, Stored vs Derived.
Relationships:
Links between entities representing their associations.
Entities
Defined as a noun representing a real-world object.
Type: Collection of entities sharing common traits; labeled with a name (e.g., EMPLOYEE).
Must have a unique identifier (e.g., Employee ID).
Types of Attributes
Simple: Atomic attributes that cannot be divided (e.g., name, id).
Composite: Attributes that can be broken down (e.g., full name as first and last).
Single-Valued: Attributes that hold a single value (e.g., age).
Multivalued: Attributes that hold multiple values (e.g., skills).
Derived Attributes: Attributes that are calculated from other data (e.g., years of service).
Identifying Attributes (Keys)
Identifier: Uniquely identifies instances; types include:
Simple Key: A single attribute (e.g., Employee ID).
Composite Key: A combination of attributes that together form a unique identifier (e.g., Flight Number + Flight ID).
Relationships
Connects two or more entities, categorized as:
Unary: Involves a single entity type (e.g., an employee manages another employee).
Binary: Involves two entity types (e.g., employee assigned to a project).
Ternary: Involves three different entity types (e.g., student, course, semester).
Cardinality Constraints: Defines how many instances of one entity can be associated with another.
One-to-One: Each instance of both entities participates once.
One-to-Many: One entity instance relates to multiple instances of another entity.
Many-to-Many: Instances of both entities can relate to multiple instances of each other.
Dependent vs Independent Entities
Dependent (Weak) Entity: Cannot exist independently (e.g., an employee reliant on a department entity).
Independent (Strong) Entity: Can exist independently (e.g., a department).
Associative Entities
Combine attributes of a relationship with properties of an entity.
Appropriate when relationships have attributes, especially in many-to-many scenarios (e.g., a student enrolled in a course).
Example: Associative entity that links vendors, parts, and warehouses detailing their supply conditions.
Business Rules in Relationships
Establish guidelines on interactions between entities, detailing how many parts a vendor can supply to a warehouse or how many courses a student may register for.
These notes summarize the complexities of data modeling in organizational contexts, highlighting the role of E-R modeling in establishing relationships, attributes, and overall database structure needed for effective database management.