Lesson 4: Introduction to Entity-Relationship Diagram (ERD)
Objectives
By the end of the lesson, you will be able to:
- Understand the purpose and components of an Entity-Relationship Diagram (ERD).
- Identify the main entities and attributes in a database schema for a management system.
Introduction
After defining the specific requirements for our inventory management system, the next step will be to apply the Entity-Relationship Diagram (ERD).
What is an ERD?
An Entity-Relationship Diagram (ERD) is a graphical representation of the data entities and their relationships within a database system. It provides a visual overview of the database structure, showing how different entities are related to each other and how they interact.
Components of an ERD
Entities
Entities represent the main objects or concepts in the database, such as Products, Suppliers, Orders, Customers, and Inventory. Each entity is depicted as a rectangular box in the diagram.
Attributes
Attributes are the properties or characteristics of entities, describing the data that is stored for each entity. For example, a Product entity has attributes such as Product ID, Name, Description, Price, and Quantity.
Relationships
Relationships define how entities are connected or associated with each other. They represent the associations between entities and specify the cardinality and participation constraints of the relationships (e.g., one-to-many, many-to-many).
Example
Consider an inventory management system for a retail store. In our ERD, we might have entities such as Product, Supplier, and Order.
- The Product entity could have attributes like Product ID, Name, Description, Price, and Quantity.
- The Supplier entity could include attributes such as Supplier ID, Name, Contact Information, and Address.
- The Order entity might have attributes such as Order ID, Date, Customer ID, and Total Amount.
Relationships between these entities could be:
- One-to-Many relationship between Product and Supplier (each product is supplied by one supplier, but a supplier can supply many products).
- One-to-Many relationship between Product and Order (each product can be included in many orders, but each order contains multiple products).
- Many-to-One relationship between Supplier and Order (each order is placed by one supplier, but a supplier can have many orders).
Summary
This lesson provides a foundational understanding of ERDs, emphasizing their role in database design and management. By comprehending the components of ERDs—entities, attributes, and relationships—learners gain insight into how databases are structured and organized.