Data Modelling

Introduction

Data modelling is the process of creating a model for the data to be stored in a database. This is a conceptual representation of data and the relationship and rules between different data and objects. Simply put, data modelling helps to build conceptual models and set a relationship between data items.

Data modelling helps visually represent data and it's relationships. They ensure consistency in naming, default values, semantics and security while maintaining the quality of data.

What is a Data Model?

A Data Model is an abstract model that organizes data. It emphasizes on what data is needed and how it should be organized, instead of what operations will be performed on it.

Data Modelling Techniques

There are two types of Data Modelling Techniques:

  • Entity Relationship Models ⇒ ER Models
  • Unified Modelling Language ⇒ UML

Why should we model data?

  • To ensure that all the data required by the database are accurately represented.
  • Helps design the database at the physical, conceptual and logical levels.
  • Provides a clear picture of the base data that can be used to create a physical database.
  • Helps identify missing and redundant data.
  • Helps make IT infrastructure upgrades and maintenance easier, cheaper and faster.

Types of Data Models

  1. Conceptual Data Models This defines what the system contains. It's purpose is to organize, scope and define business concepts and rules

  2. Logical Data Models This defines how the system should be implemented, regardless of the database and it's data. It's purpose is to develop a technical map of rules and data structures.

  3. Physical Data Models This describes how the system will be implemented using a specific database. It's purpose is the actual implementation of the database.

So, How do you create a Data Model?

In javascript, you create data models by creating objects. The key will be the field and value will hold whatever value you want to store in the field.

For example, a basic products data model will look like this :

const products = {
      id: 1234, //number or id
      name: "Product Name", //string
      description: "Product Description", //string
      brand: "Product Brand", //string
      price: 12.34, //number
   }

The key is the field, value is the value we want the field to have and in comments is the data type of the values this field can store.

We always create data models as objects because this helps keep the database sizable.

Conclusion

Data modelling is the process of developing models for the data to be stored in a database. These ensure consistency in naming, default values, semantics and security while ensuring quality of data. Data modelling helps to define relational tables, primary and foreign keys and stored procedures. The main goal of designing a database is to make certain that data objects offered are represented accurately. The biggest drawback is that even small changes made in structure require modification in the entire application.