Data Modelling Concepts

INF2603 - Databases I · Database Design

Data Modelling Concepts

Data modelling is a crucial aspect of database design. It involves creating a visual representation of data and its relationships within a system. This helps in understanding how data is structured and how it can be used effectively.

What is Data Modelling?

Data modelling is the process of defining and analysing data requirements needed to support the business processes of an organisation. It provides a framework for data management and helps in designing databases that meet user needs.

Remember: Data modelling is essential for effective database design and management.

Types of Data Models

There are several types of data models, but the most common ones are:

  • Conceptual Data Model: This model provides a high-level view of the data. It focuses on the entities and their relationships without going into details about how the data will be stored.
  • Logical Data Model: This model defines the structure of the data elements and the relationships between them. It is more detailed than the conceptual model but does not specify how the data will be physically stored.
  • Physical Data Model: This model describes how the data will be stored in the database. It includes details such as data types, indexes, and constraints.

Entities and Attributes

In data modelling, an entity is a thing or object in the real world that is distinguishable from other objects. An entity can be a person, place, event, or concept. Each entity has attributes, which are the properties or characteristics of the entity.

Example of Entities and Attributes

Consider a university database. The following entities and their attributes can be identified:

  • Student: Student_ID, Name, Surname, Date_of_Birth, Email
  • Course: Course_ID, Course_Name, Credits
  • Instructor: Instructor_ID, First_Name, Last_Name, Department

Relationships

Relationships describe how entities are related to one another. There are three main types of relationships:

  • One-to-One (1:1): Each entity in the relationship will have exactly one related entity. For example, each student has one student ID.
  • One-to-Many (1:N): One entity can be related to many entities. For example, one instructor can teach many courses.
  • Many-to-Many (M:N): Many entities can be related to many entities. For example, students can enroll in many courses, and each course can have many students.

Example of Relationships

In our university database, the relationships can be defined as follows:

  • One student can enroll in many courses (1:N).
  • One course can have many students enrolled (M:N).
  • One instructor can teach many courses (1:N).

Watch out: Be careful not to confuse one-to-many and many-to-many relationships. Understand the context of the data to define the correct relationship.

Data Modelling Techniques

Several techniques can be used for data modelling, including:

  • Entity-Relationship (ER) Modelling: This technique uses ER diagrams to visually represent entities, attributes, and relationships.
  • Unified Modeling Language (UML): UML is a standard way to visualize the design of a system. It includes various diagram types, such as class diagrams, which can represent data models.

Example of ER Modelling

To create an ER diagram for the university database, follow these steps:

  1. Identify the entities: Student, Course, Instructor.
  2. Define the attributes for each entity.
  3. Determine the relationships between the entities.
  4. Draw the ER diagram using rectangles for entities, ovals for attributes, and diamonds for relationships.

Normalization

Normalization is a process used to organize data in a database to reduce redundancy and improve data integrity. It involves dividing a database into tables and defining relationships between them. While normalization is a separate topic, it is essential to understand its role in data modelling.

Remember: Normalization helps to eliminate data redundancy and maintain data integrity.

Summary

  • Data modelling is the process of defining and analysing data requirements.
  • There are three types of data models: conceptual, logical, and physical.
  • Entities are objects with attributes, and relationships describe how entities are related.
  • Normalization is important for reducing redundancy and improving data integrity.

Check your understanding

  1. What is the difference between a conceptual data model and a physical data model?
  2. Define the term 'entity' and provide an example.
  3. What are the three types of relationships in data modelling?
  4. Explain the purpose of normalization in database design.