Databases: Introduction to Data Models

It is no news that data and databases are an important bit of every application and for us to store some data in a database, we need some data-structures, hence the database systems we use usually include some complex data structures which we normally do not use. To make the system efficient in terms of data retrieval, and reduce complexity in terms of usability, developers use data abstraction which refers to hiding irrelevant details from the users. To be able to make data abstraction possible, developers make use of data models.

You might be wondering what a data model is, well it is simply a concept or notion for describing data, data relationships, data constraints and data semantics or simply put, a data model is way of defining how the logical structure of a database is presented or modeled. The different types of data models can be classified into the following categories;

High-level Conceptual Data Models

They present or model data in a way that is similar to how humans perceive data. A typical example of a High-level Conceptual Data Model is the Entity-Relationship(ER) model which is based on the notion of real-world entities(objects) and the relationships among them. A relationship represents an logical association among entities and they are mapped with entities in various ways which could be;

  • One to One

  • One to Many

  • Many to One

  • Many to Many

The diagram below represent an ER model.


Record-based logical Data Models

Record-based logical data models provide concepts users can understand but are still similar to the way data is stored on the computer. Three well-known data models of this type are: hierarchical, network, and relational data models.

  1. Hierarchical model

    In a hierarchical model, data is organized in a tree-like structure, implying a single parent for each record. This structure obliges that each child record has only one parent, whereas each parent record can have one or more child records. This model is illustrated below:

download (1).png

  1. Network model

    The network model expands upon the hierarchical structure, allowing each record to have multiple parent and child records. It replaces the hierarchical tree with a graph thus allowing more general connections between the records. It was the most popular model before being replaced by the relational model. The network model is shown in the diagram below:


  1. Relational model

    The relational model represents data as relations or tables. For example, a database system may contain multiple tables (relations) which in turn have several attributes (columns) and tuples (rows). It is the most popular data model. The relational model is shown in the diagram below:


Physical data models

The physical data model represents how data is stored in computer memory, how it is scattered and ordered in the memory, and how it would be retrieved from memory. There are not as many physical data models as logical data models. An example of a physical data model is the Unifying Model. The diagrammatic representation of physical models is shown below: physical-data-model.png

Thank you for reading my write-up and if you found it helpful please don't hesitate to like and share. Follow me on twitter at @flaacko_flaacko. Watch out for more posts on databases, until then goodbye👋👋.

No Comments Yet