7.4 Data Modelling and ERDs
7.4 Data Modelling and ERDs
1. Conceptual data modeling: This stage involves identifying the entities (things,
events, or concepts) that will be stored in the database, as well as the relationships
between them. The conceptual data model is typically represented using an entity
relationship diagram (ERD).
2. Logical data modeling: This stage involves refining the conceptual data model by
adding more detail, such as data types and constraints. The logical data model is
still independent of any specific database management system (DBMS).
3. Physical data modeling: This stage involves converting the logical data model
into a physical data model that is specific to the DBMS that will be used to
implement the database. The physical data model includes details such as table
names, column names, and data types.
Entity Relationship Diagram (ERD)
● Entities: Entities are the things, events, or concepts that will be stored in the
database. Examples of entities include students, teachers, courses, and
grades.
● Relationships: Relationships define the associations between entities.
Examples of relationships include "enrolled in" (student and course), "taught
by" (teacher and course), and "received" (student and grade).
● Degree of relationship (cardinality): Cardinality defines the number of
occurrences of one entity that can be associated with a single occurrence of
another entity. There are three main types of cardinality:
○ One-to-one: Each occurrence of one entity can be associated with only
one occurrence of the other entity.
○ One-to-many: Each occurrence of one entity can be associated with
multiple occurrences of the other entity.
○ Many-to-many: Each occurrence of one entity can be associated with
multiple occurrences of the other entity, and vice versa.
● Attributes: Attributes are the properties of entities and relationships.
Examples of attributes include student ID, student name, course code, course
name, teacher name, and grade.
Examples:
Construct an E-R diagram for the following problems:
A car-insurance company whose customers own one or more cars each. Each car has
associated with it zero to any number of recorded accidents.
A hospital with a set of patients and a set of medical doctors.
Associate with each patient a log of the various tests and
examinations conducted.