Back to articles list
- 8 minutes read

The Difference Between Entities and Attributes in a Data Model

The entity-relationship model is composed of different elements. The most important types of elements are the entities and their attributes. In this article, we go into detail about the distinction between them, the role they play in a data model, and the steps to create them in Vertabelo.

What Is Data Modeling?

Data modeling is carried out by a database architect or database modeler. It is the process of creating a diagram that lists the set of data structures that are going to be the data backbone of a software application. These data structures are the entities and attributes in a data model.

Sometimes, it is an easy process, and you come up with the ideal solution quite quickly. Other times, it is a difficult process involving numerous hours of designing and discussing with the stakeholders and business analysts. You want to make sure the data model can support all of the business processes that need modeling.

Thinking about your data and how it moves through your relational database before starting to build your application helps you spot places for improvement. This is a key benefit of data modeling and one of the aspects I like about it. It offers a big advantage by laying out all of the details of the data that goes into your application. It helps you avoid rework in the future when new information about the business is added.

Building a relational data model of a database, sometimes called the entity-relationship model, is done by going through a set of predefined phases of the data model. By doing so, you are almost guaranteed to build a resilient data model that fits your needs.

The final relational data model is simply a set of tables with relationships and constraints among them. Data is stored in their respective tables called entities, so that it is organized and easily accessible by using the least amount of resource.

As mentioned before, building the entity-relationship model is done by going through three major design phases that build three intermediate data models: the conceptual data model, the logical data model, and the physical data model.

All of these intermediate data models are variations of an entity-relationship model, each with the same information but at different levels of detail.

Conceptual Data Model

We always start the data model design process with a conceptual data model. The goal of this phase is to sketch out a simplified version of the entity-relationship model, composed of only the entities and their relationships.

Designing a conceptual data model for a store in Vertabelo may be represented as we have below. In this model, we have identified the main entities and the relationships among them.

entity relationship model

Logical Data Model

Once we define our conceptual data model by representing the entities, we add more information about these entities in the form of attributes. We also identify which attributes can represent the primary identifier for each row, marked by "PI". Once we have completed these steps and expanded our entity-relationship model, we have essentially built the logical data model.

entity relationship model

Physical Data Model

The final iteration of an entity-relationship model is the physical data model. This is a representation of the final form of the model, applied to the target database where the model is deployed.

In this step, we create a diagram very similar to the one in the logical model, but all of the entities and attributes in a data model are converted into their final form of tables and columns, respectively. We also convert the data types from the logical model into the corresponding data types of the target database.

The coolest thing: Vertabelo Modeler can automatically generate this physical data model with just a few clicks! It automatically chooses the right data types that are compatible with the target database engine.

entity relationship model

Entities and Attributes in a Data Model

When designing any data model, the main focus is on identifying entities and attributes. Building any entity-relationship model involves identifying what the entities are and what the attributes are, all from the requirements.

The distinction between entities and attributes is very important, and there needs to be a balance between the number of entities and the number of attributes in your data model. It is possible to create an entity-relationship model with only entities or one with just a single entity and multiple attributes. But this is generally not the case, since it’s best to apply the appropriate level of normalization whenever creating an entity-relationship model.

Building out your database requires you to understand your problem domain very well. Once you have a solid understanding of that, you can correctly identify the entities and the attributes that will go into the design of the entity-relationship model.

What Is an Entity?

In your entity-relationship model, an entity is a representation of either a physical object from the real world or a singular concept that is generally very well defined and delimited.

In the conceptual data model, we aim to identify the main entities in a problem domain and represent them. In our previous conceptual model diagram, we had three entities identified, all highlighted with different colors in the image below. These represent the main entities that interact in the context of a store that sells different products.

entity relationship model

What Is an Attribute?

That said, defining every detail of a problem as an entity is not a good practice. This is why we define an additional set of details that are specific to each entity and are inherited by each individual of the same entity type.

These additional details are called attributes. They define the real entity or concept much better. Expanding the diagram of just the entities as we have above, the attributes complete the final form of an entity. When we identify the entities and their attributes as well as the most important relationships between the entities, we have built a minimal entity-relationship model.

entity relationship model

Once the attributes are defined inside an entity, we can now translate them to their representation in a relational database. You see in the diagram above that we have a physical data model of the store sales scenario, with entities and attributes.

This is where the entities are mapped to tables and their attributes become columns in the tables. The attributes also get appropriate data types and associated constraints to represent the entity-relationship model correctly.

How to Define Entities and Attributes in Vertabelo

Most of the diagrams shown above have been created in Vertabelo Modeler. We are going to quickly show you how you recreate this entities-and-attributes example in an entity-relationship model in Vertabelo Modeler.

After logging into Vertabelo Modeler, start by creating a logical data model on your Documents page. If this is your first time working with Vertabelo, we have a tutorial showing you how to create a logical model.

Once you have the document created, the first step is to add a new entity. This is done by pressing this button and then clicking anywhere on the design canvas.

entity relationship model

This automatically creates a new entity, usually called entity_1 by default.

entity relationship model

To rename it, select the entity on the canvas. Then look at the right side of your screen, where the entity properties panel is situated. You can add the new name here as well as add any attributes to this entity by clicking on “+ Add attribute”.

entity relationship model

For recreating the Product entity in our new diagram, the configuration for the entity and the attributes looks like this:

entity relationship model

As you see, you also need to add the data type for an attribute whenever defining a new one for an entity. By pressing the small settings button next to each Data type, you see all the available data types for an attribute. Please note that these are general logical data types for the attributes since this is a logical data model. They are not the final data types of the columns in a physical data model.

entity relationship model

Also, it’s a good practice to choose whether that attribute is mandatory when new instances of data are inserted for that type of entity. This is denoted by the column of checkboxes with "M" in the header.

Even more importantly, in general, every entity that eventually becomes a table needs to have a primary identifier. This is the next column of checkboxes with "PI" in the header.

Whenever designing your entity-relationship model, remember to define the naming convention you are going to use throughout your model. It’s important to keep consistency in the naming of multiple entities and attributes. As time goes on and the model grows in size, you need to be able to identify what type of information is stored there from the name quickly. Also, it makes querying much easier when entities and attributes follow a similar naming pattern.

A Finished Entity-Relationship Model

With all of this information, you can now confidently build your entity-relationship model using Vertabelo Modeler. Not only does it have all the features you need to create the entities, attributes, and relationships, but it also has many other features that allow you to build a data model down to the finest detail possible.

If you want to explore all of the features the user interface provides, we have an article explaining all of them here. We also have some tips for you before you start your data modeling journey. So, rest assured you’re on the right path when you use them.

go to top