Detailed Notes on Data Modelling
Detailed Notes on Data Modelling
Data modelling is the process of defining how data is structured, stored, and related within a
database. It helps in designing a database that ensures data integrity, reduces redundancy, and
facilitates efficient data retrieval.
An entity class is a set of objects (people, places, things) about which data needs to be stored.
Each entity class has unique characteristics that distinguish it from others.
Primary Key
A primary key is a field (or combination of fields) that uniquely identifies each record in an
entity. It ensures no duplicate records exist.
Example
Understanding Relationships
Relationships describe how entities interact with each other. They are categorized based
on cardinality:
1. One-to-One (1:1) – Each record in entity A is related to only one record in entity B.
2. One-to-Many (1:M) – One record in entity A can be associated with multiple records
in entity B.
3. Many-to-Many (M:M)Multiple records in entity A relate to multiple records in entity
B (requires an intersection table).
Once entities, attributes, and relationships are defined, the database is created using a Data
Definition Language (DDL).
Steps include:
Normalization Rules
A foreign key is a field in one table that refers to the primary key in another table,
establishing a relationship.
A composite key consists of two or more fields used together as a primary key (e.g.,
"Job Assignment" table using Employee ID and Job Number).
5. Conclusion
Data modelling is critical for designing databases that are structured, efficient, and scalable.
By following best practices like entity identification, relationship mapping, and
normalization, data consistency is maintained, and redundancy is reduced.
6. Visual Representation
Basic E-R Diagram Example
[ Employee ] 1 -- (works in) -- M [ Department ]
[ Employee ] M -- (performs) -- M [ Job ] (resolved using Job Assignment
table)
Employee Table
Employee ID (PK)
Name
Job ID (FK)
Job Assignment Table (Intersection Table)
Employee ID (PK, FK)
Job Number (PK, FK)
Department Table
Department Num (PK)
Department Name