After reading this article you will know:

  • What a relational data model is
  • Why we use a relational data model
  • What is connected in a model relation

In the What's a data model article, you have learned what a data model is used for in every application. Relations are essential parts of the data model as we now know in Betty Blocks applications. With a relation, we can associate different data to each other in a visual way.

Why a relational data model?

Although the application's datamodel is based on MySQL technology, you won'y have to deal with that as a developer. Betty Blocks does this in a visual way. You can build models and drag relations while the platform is taking care of everything that needs to happen behind the scenes. Using a relational datamodel these five advantages for you as a user:

  1. Your data is stored once and at one place in the data model: With this, you can have easy access to all your data. Data duplication is brought to a minimum, which means your data is stored efficiently.
  2. Better security and authorization: When setting up a user-role relation a role-based structure can be created in your application. Every new Betty Blocks application starts with this structure for your backoffice, this way you can hide or show certain parts of your application depending on the role of the user.
  3. Better performance: Because your data is stored efficiently the performance of the application will increase. Searching and presenting data will be easier and faster.
  4. Ensures better data integrity: With applications that expect inserted data from users, it is good to check if that data is within the correct format. With models, you can easily control and validate the data that is inserted. This way it won't be possible to have empty or faulty data within your database.
  5. Complex queries can be carried out: Data can be easily found because it is stored efficiently. Also with the data model design tool, queries won't have to be coded.

What do we connect in a relation?

The relational data model is based on creating relations (associations). What do we connect? Every model is given a default property id: the identifier of every object a model has. For example: you have created four customers (as objects) and they are stored in the Customer model. We are using the property id to identify every single customer as an object. These object id's are connected by creating relations. The customer id we spoke earlier about is for example connected to an invoice id. The type of a relation between models indicates the number of related objects. In this case, a customer object can have multiple invoice objects.

Learn more about three relation types there are to build your associations with between models.

Did this answer your question?