Resources | Subject Notes | Information Technology IT
This section details the creation of Entity Relationship Diagrams (ERDs), a fundamental tool for database design. ERDs visually represent the entities, attributes, and relationships within a system. We will cover both conceptual and logical ERDs.
A conceptual ERD provides a high-level overview of the data requirements of a system. It focuses on the key entities and their relationships without specifying details like data types or cardinalities.
Entities are real-world objects or concepts that we want to store information about. They are typically represented by rectangles.
Attributes are properties or characteristics of an entity. They are represented by ovals and are connected to the entity by lines.
Relationships represent how entities are related to each other. They are represented by diamonds and are connected to the entities involved.
Cardinality specifies the number of instances of one entity that can relate to another entity. Common cardinalities include:
A logical ERD is a more detailed representation of the data requirements. It specifies the data types of attributes and defines primary and foreign keys.
Entities are still represented by rectangles, and attributes by ovals. However, logical ERDs include details about the attributes.
Relationships in a logical ERD are defined with specific cardinalities and participation constraints. Participation constraints indicate whether an entity instance must participate in a relationship.
Primary keys uniquely identify instances of an entity. Foreign keys are attributes in one entity that reference the primary key of another entity, establishing a link between them.
Consider an online shopping system. Here's an example of a conceptual ERD:
This conceptual diagram shows that a Customer places one or many Orders, and each Order contains one or many Products.
Here's a possible logical ERD for the same system:
This logical diagram specifies attributes like CustomerID (PK) for Customer, ProductID (PK) for Product, and a composite primary key of OrderID (PK) for Order. It also defines the relationships with cardinality (e.g., 1:N between Customer and Order).
The process of creating ERDs typically involves the following steps:
Chen's notation is a common standard for drawing ERDs. It uses rectangles for entities, ovals for attributes, and diamonds for relationships.
Symbol | Meaning |
---|---|
Rectangle | Entity |
Oval | Attribute |
Diamond | Relationship |