The data model gives us the conceptual idea of how the data will be stored, manipulated in the database and how the final system will look after its implementation. It is just the conceptual view. Through the data models, we define how the logical structure of the Database will be modelled.
The relational data model is the most widely used model by database management applications. It uses collections of tables for representing data and the relationships among the data. The data is stored in the form of tables which are also known as relations. Each table is a group of columns and rows, where the column represents the attribute of an entity and the rows represent the records (or tuples).
Attribute (field)
Each column in the table is called an attribute. The domain of each attribute must be the same. For example, if a column represents age where the domain is a positive integer, every age record must have a positive integer value.
Tuple (a record)
The rows in relation or table are known as a tuple. Tuples are also called records. The tuple is a collection of attribute values.
In the above table, the attributes are Student_ID, name, and age.
There are a total of four tuples in the above table.
The ER data model is a high-level data model. It serves as a blueprint for the actual representation of the data, which is later implemented as a database. The ER model is physically represented in the SQL. ER model describes the structure of a database with the help of a diagram, which is known as the entity-relationship diagram. The two main components of the ER model are :
Entities
An entity is a real-world object or thing. For example, a car, a student, a college, a course. Such things are known as entities. In the ER model, we try to define a relationship or association between two entities. For example, there can be two different entities like managers and departments. Through the ER model, we try to find an association between the managers and the department. The entities have various characteristics known as attributes.
Relationship
A relationship tells us how various entities are interrelated. It represents the association between two entities. For example, consider two different entities managers and departments, the relationship between them is "manages." Each manager "manages" a department. Similarly, each department will be managed by at least one manager.
Below is an example of an ER model diagram.
Object-based Data Model
The Object-based data model is also known as the object-oriented data model. The object-based data model is just an extension of the entity-relationship model with some extra notions of functions, encapsulation, and object identity. In an object-oriented data model, the data and relationship are present in a single structure called an object. A link is used to connect the objects. These objects are related with the help of the link.
Consider the below example:
There is an employee object. All the data and relationships are contained as a single unit. The attributes and methods are also stored in a single unit.
The semi-structured model is a modified form of the relational model. The semi-structured data model allows the data specifications at places where the individual data items of the same type may have different sets of attributes. In this model, some entities may have missing attributes while others may have an extra attribute. The semi-structured data model is represented using the Extensible Markup Language (XML).
This is one of the older forms of data models. This data model is represented using a tree-like structure. Each entity has only one parent. However, it can have many children. At the top of the hierarchy, there is a single entity known as the root.
The network data model is a modified version of the hierarchical model. It is represented by a graph. Unlike the hierarchical model, in the network model, there can be more than one parent entity or the root. It provides extra flexibility in representing the data. It is also easier and faster to retrieve data using this method compared to the network model. Here a child entity can have more than one parent entity, i.e., an entity can be related with multiple entities.
You can also know about different types of DBMS in detail.
FAQs
What is a data model? The data model gives us the conceptual idea of how the data will be stored, manipulated in the database and how the final system will look after its implementation.
What are the various data models? Relational model, ER model, Object-oriented model, semi-structured model, hierarchical model, network model.
Which data structure is used in hierarchical data models? Tree data structure.
How is the relational data model represented? In the form of tables having rows and columns.
Which data structure is used in a network data model? Graphs.
The data model gives us the conceptual idea of how the data will be stored, manipulated in the database and how the final system will look after its implementation.
Through the data models, we define how the logical structure of the database will be modelled.
The various types of data models are the Relational model, ER model, Object-oriented model, semi-structured model, hierarchical model, network model.
The relational model uses collections of tables for representing data and the relationships among the data. The data is stored in the form of tables which are also known as relations.
The ER data model is a high-level data model. It serves as a blueprint for the actual representation of the data, which is later implemented as a database.
The object-based data model is just an extension of the entity-relationship model with some extra notions of functions, encapsulation, and object identity.
The semi-structured method is a modified form of the relational model. The semi-structured data model allows the data specifications at places where the individual data items of the same type may have different sets of attributes.
The network data model is a modified version of the hierarchical model. It is represented by a graph.
Never stop learning. Explore the top 100 SQL problems here.