What is a relational data model?

This article briefly describes relational data models and the advantages provided when you use them.

Updated over a week ago

After reading this article you will know:

  • What a relational data model is

  • Why do we use a relational data model

  • What is connected in a model relation

In the what's a data model article, we explain what a data model is used for in an application. Relations are essential parts of any data model in Betty Blocks applications. Using a relation, we associate different data with each other in a visual way.

We created a video that explains relations as well, check it out:

Why a relational data model?

There are two ways to create a data model, you can go the relational route or the non-relational route. Creating a non-relation data model stores your data but doesn't give you the flexibility of a relational data model. It uses a storage model that's optimized for very specific requirements of the type of data that it stores. For example, storing just one type of data that you'll never change or know will never have any mutations through its lifecycle.

Creating a relational data model does give you a lot of flexibility, you can add models when needed and create relationships between models to retrieve data. Think about when you have an employee who's part of a team that also works on various projects. You can relate the data from an employee, to a team and a team to a project.

Relations between models

If you create an application with the above example in mind you can retrieve the data of any of the three models via any one of them. If you'd add a fourth model like a task model you can create a relation between it and the project model. Thanks to the relation, assigning tasks to an employee are now easily done.

How do you create a relation between models

Creating a relation between two models is done by dragging the arrow you see when you mouse over a model to another model.

Setting up the relations between models

You can then choose what type of relation you want.

Relation type selector

Once you've selected the type you are now working with a relational data model. You can also do this from the relation tab in your model if you prefer to create a relation from there.

Relations tab

What is connected with a relation?

The relational data model is based on creating relations (associations). Every model is provided with a default property identifier (ID). This ID is the unique identifier applied to each object in a model. Unique identifiers are essential for ensuring integrity in a database. The following example provides an example of what is connected using a relation:

An employee model is created. Four employees are stored in the employee model. Each employee is treated as an object in the model and the employee model property ID provides a unique label for each employee as an object (object id).

Relations are used to connect models and the relation is established using object id's. For example, an employee model is connected with the team model - in data terms, an employee id is connected with a team id. The Type of relation between models indicates the number of related objects with which it can be connected.

In this case, a team object can have multiple employee objects.

What's behind it

In Betty Blocks, an application's data model is based on MySQL technology. However, you do not need development-level coding skills for building a data model. You can use the visual interface (schema view) in Betty Blocks for designing and building the individual models that comprise an application's data model, as seen in the section above. You can build models and drag relations that simultaneously map out the data relationships in the underlying technology.

What exactly is the benefit

Using a relational data model provides the following advantages for you as a user of the Betty Blocks platform:

  • A single record of data in a single place in the data model: With this, you can have easy access to all your data. Data duplication is reduced ensuring that data is stored efficiently.

  • Improved security and authorization: When setting up a user-role relation, a role-based structure can be created in your application. When created, all Betty Blocks applications are provided with this structure. This means you can control what parts of an application are displayed based on a user's role.

  • Improved performance: As data duplication is reduced, the performance of an application increases. Searching and presenting data is easier and faster.

  • Ensure data integrity: You can ensure that any user input data fields comply with formatting requirements to avoid introducing false responses. Using models, you can control and validate input data fields. This helps reduce errors and increases the integrity of the data in your database.

  • Perform complex queries: Data can be easily located as it is stored efficiently. Using the in-built data model design tool, you do not have to. Also with the data model design tool, queries won't have to be coded.

Did this answer your question?