Database Models

Common database models explained in pictures

Practicum by Yandex
Dec 4, 2020 · 5 min read

Databases allow us to organize information in a way that’s easy for computers to work with, while keeping it intelligible for humans. The term “database model” is used to describe how a database is structured and used and determines how data can be stored, organized, and manipulated. In this article, we’ll dive into the three major database models.

A key thing to note is that one type of database might be great for building websites or managing online stores, while another type might be better for more complex applications, such as a product recommendation feature. Knowing the three main types of models will help you to choose the most appropriate one to use.

With that in mind, let’s dig a bit deeper and broaden our database horizons!

Three main types of database models

The type of database model you’ll use depends on the type of data you’ll be storing and how you’ll be working with it. These models are divided into relational and non-relational:

Relational model

A relational database organizes data in tables, and these tables are linked to other tables. For example, we might have a database of products that were purchased from a store:

Here we have two separate tables, one listing the products available at the store and the other containing customers. Additionally, whenever a customer buys something, the data goes into a third table which lists all of the purchased products. This last table has its own unique information (the number of purchased products) and also has links to both the product and client tables. If we need to, we can use these links to get further details about one item or another. For example, we can find out who exactly bought the stool and how much it cost.

Let’s illustrate another benefit of relational databases with an example. Let’s say that a customer changes their phone number. In this case, we only need to update that information in the “Customers” table. Since the “Purchased Products” table only contains the customer’s ID, we don’t need to do anything here. When we change some information about the customer in the “Customers” table, this information will be automatically updated across the entire database.

Network model

Unlike relational databases, in network databases, there can be several different relationships between tables and records, with each relationship being responsible for something different.

Actually, you’ve probably already used a database like this. For example, if we consider a movie database such as IMDb, we can illustrate the relationships in such a database as a net-like scheme:

The defining characteristic of network databases is that they store all the relationships and all content for each relationship. We won’t need to spend extra time searching for the required data because all the information about it is already stored in special index files. These files show which records are associated with each other, and will quickly return the result.

Let’s break this down a bit more. For example, let’s imagine a user has watched Christopher Nolan’s Inception and they loved it. This user would now like to find some other movies directed by Nolan using an online database. The process works as follows:

  • Take the name of the director
  • See which relationships exist for this director
  • Display a list of related movies
  • Additionally, display a list of actors, and a poster for each movie

The most important thing is that the network model allows us to do all of this very quickly as there is no need to look through the entire database. It immediately finds any records related to movies and returns the result to the user.
Hierarchical model

The hierarchical model implies there are superior and subordinate records. Further, these subordinate records may have their own subordinates. We’ve already covered this model in the article about the trie data structure.

In a hierarchical database, we can immediately see what the records relate to, where they are stored, and how to reach them. The simplest example of such a database is the way files and folders are stored on computers:

We asked our manager to show her local work folder on Ubuntu Linux. Here we can see that there are several different folders in her Home partition: Documents, Downloads, Videos, etc.

In this directory, the parent Documents folder contains a subordinate folder, the Practicum folder. This child folder contains various other folders, including Sprint 1, which also contains a file and two more folders which each contain their own files .

Like the network model, the hierarchal model also lets us quickly find information. However, it can only be applied when there is a clear division between superior and subordinate data.


  • Most often, data in a database can be presented as a table with one piece of data corresponding to one parameter. For example, one customer has one name, one phone number, and one address.
  • Databases that can be organized in table form are called relational databases.
  • In order to build complex relationships, different tables in a relational database can be linked.
  • A relational database is not the only way to store data. There are situations when we need more flexibility.
  • The network model allows us to store many relationships between many entities. For example, in a movie catalog: many people can take part in creating a movie, and a person can take part in creating many movies.
  • In a hierarchical database model, data is organized in a tree-like structure. An example of this is the file system on your computer.
  • Your choice of database will depend on what you want to do. No database model is inherently better than another, but each of them are better suited to different types of tasks.

Feel free to browse the resources at Practicum. We provide education and mentorship to help you build essential tech skills and amp up your career.

Practicum by Yandex

Your starter pack to break into tech

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store