Lecture 3A
Lecture Overview
Data Modelling and Databases
Learning Objectives
Understand Entity Relationship and Data Modelling
Information Systems
Definition: Set of interrelated components that collect and process data to produce information.
Importance of Data Storage: Efficient and effective organization in databases requires modeling.
Data Modelling Concepts
Key Components
Entities: Core components representing "things" the data is about.
Attributes: Characteristics that define the entities.
Relationships: Connections and associations between entities.
Entities Explained
Definition: Category or group that represents tangible or intangible items (e.g., employee, product).
Instance: Concrete example of an entity (e.g., specific employee records).
Examples of Entities
People: Lecturer (Vikas Grover), Students (James, Amy, Laura, Xiaoxia)
Teams: e.g., Team A, Team B
Customers: Categories refer to buyers in a system rather than individuals.
Attributes
Definition: Properties of an entity that have specific values.
Missing Values: Attributes can have null values for specific instances.
Types of Attributes
Simple: Cannot be further divided (e.g., age).
Composite: Can be broken down into smaller components (e.g., full address into street, city).
Single-Valued: One value per attribute.
Multi-Valued: More than one value for an attribute (needs separate entity for storing).
Stored vs. Derived:
Derived: Calculated from other attribute values.
Stored: Original attribute value used in derivation.
Business Rules
Define behavior and constraints within a domain, such as relationships in a bookstore (e.g., customers purchasing many books).
Entity-Relationship Diagrams (ERD)
Purpose and Functionality
Purpose: Identify and represent relationships between entities in a visual format.
Developed by Peter Chen in 1976.
Types of Relationships
Cardinality:
One-to-One: A to B
One-to-Many: A to multiple Bs
Many-to-Many: Multiple As to multiple Bs
Optionality:
Mandatory: Entity must participate.
Optional: Participation not required.
ER Diagram Components
Symbols used in ER Diagrams
Entity: Represented by rectangles.
Attribute: Represented by ovals.
Relationship: Represented by diamonds.
Types of relationships indicated with symbols for mandatory and optional.
ER Diagram Examples
Example 1: Employee connections with Orders and Customers.
Example 2: Pub and Beer relationships involving drinkers.
Conventions in ER Diagrams
Use singular form for entity names.
Capitalize the first letter of entity names, lower case for attributes.
Avoid using spaces in names (underscore instead).
Positioning of entities is flexible, but avoid crossed lines for clarity.
The Importance of ERD
ERD serves as a foundational step in database development.
Each entity corresponds to a separate table in a database.