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?
The application's data model is based on MySQL technology, which is actually less important for you to speak further about because you as a developer has nothing to deal with MySQL. However, you are using the data model to visually build models and relations and the application is taking care of the rest. Using the relational data model technology instead to other technologies could be explained into five advantages for you as a user:
- Your data is stored once and at one place in the data model. Which means a more efficient storage. No data duplication.
- Better security and authorization. Application users are authorized to view certain models (information) or not. Authorization is based on roles. The role-based structure is defined in your application.
- Better performance. For searching and presenting data.
- Ensures better data integrity. For the inserted data, because of creating the right model relations.
- Complex queries can be carried out. And with the data model design tool, you don't have to code these queries anymore.
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. An example: you have four customers (as objects) created and they are stored in the Customer model. We are using the property id to identify every single customer as an object. These object ids 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.