Difference between ER Model and Relational Model
The E-R Model and Relational Model are two aspects of the Data Model in DBMS that are used to construct databases at the physical, logical, and view levels. This article explains the complete overview of the E-R Model and Relational Model. The difference between these models is the most common part of an interview question. The key distinction is that the E-R Model is entity-specific, while the Relational Model is table-specific. Before making the comparison, we will first know these Data Models.
What is ER Model?
An ER model stands for the Entity-Relationship model that Peter Chen developed in 1976. This model consists of a collection of entities (Real word objects) and their relationships. It describes the database's conceptual view. We must ensure that no two entities are identical in this context.
ER Model describes the system's logical view from a data perspective formed by the entity set, relationship set, and attributes. In this model, all entities come under the entity set, all relations between the entities come under the relationship set, and attributes describe the properties of entities.
Let us understand ER model with an example. Suppose we have two real-world entities named Student and Branch that will further form an Entity set. Now we can easily form a relation between them as the Student belongs to a Branch. It shows how we can get a relationship set from ER Model. Noted that the ER Model content must conform to constraints like mapping cardinality. Finally, the attributes of these entities would be:
For Student: stud_id, stud_name, address, mobile, mail-id.
For Branch: branch_id, branch_name, num_of_stud.
What is the Relational Model?
In 1970, E.F. Codd developed the relational model. He proposed this model as well as a non-procedural approach for modeling data in the form of relations or tables. In the Relational Model, tables are usually interpreted as relations. If we model the database using ER diagrams, we must convert them into the relational model, which can be implemented by one of the RDBMS languages such as SQL and MySQL.
In the relational model, each table contains rows and columns where we can have any number of rows, but the number of columns must be definite. The table rows are called tuples that include the complete information about specific entities. Records are a set of tuples, so the Relational model is also known as the Record-based Model. Table columns are called attributes because they characterize a table's properties. To store values, each attribute must have a type.
Key Differences between ER Model and Relational Model
The following points explain the main differences between ER Model and Relational Model:
ER Model vs. Relational Model Comparison Chart
The following comparison chart explains their main differences in a quick manner:
In this article, we have made a comparison between ER Model and Relational Model. We may conclude that if we convert an E-R model to a Relational model, we must ensure that each strong entity has its own table.