Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: Mar 27, 2024

Data Models

Author Ankit Kumar
2 upvotes
gp-icon
Dbms - Database management systems
Free guided path
12 chapters
93+ problems
gp-badge
Earn badges and level up

Introduction

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 various types of data models are:

  • Relational Data Model
  • Entity-Relationship (ER) Data Model
  • Object-based Data Model
  • Semi-structured Data Model
  • Hierarchical Data Model
  • Network Data Model
     

Also Read, Schema in DBMS and Checkpoint in DBMS

Relational Data Model

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.


Also See - Specialization and Generalization in DBMS And Recursive Relationship in DBMS

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Entity-Relationship (ER) Data Model

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.

Also read - multiple granularity in dbms

Semi-structured Data Model

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).

Example:

<Employee 1>
<name>..............</name>
<age>.................</age>
<salary>.............</salary>
</employee 1>

 

Hierarchical Data Model

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.

Also Read - Cardinality In DBMS

Network Data Model

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.

Example:

Recommended Topic, B+ Tree in DBMS

You can also know about different types of DBMS in detail.

FAQs

  1. 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.
     
  2. What are the various data models?
    Relational model, ER model, Object-oriented model, semi-structured model, hierarchical model, network model.
     
  3. Which data structure is used in hierarchical data models?
    Tree data structure.
     
  4. How is the relational data model represented?
    In the form of tables having rows and columns.
     
  5. Which data structure is used in a network data model?
    Graphs.

Take this awesome course from coding ninjas.

Key takeaways

  • 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.

Happy learning!

Previous article
Relational Calculus in DBMS
Next article
Database Languages
Guided path
Free
gridgp-icon
Dbms - Database management systems
12 chapters
93+ Problems
gp-badge
Earn badges and level up
Live masterclass