Introduction to Types of Data Model
For the creation of any database, the data model is considered a logical structure for creating a database. The data model includes entities, attributes, constraints, relationships, etc. The data models are used to represent the data and how it is stored in the database, how data is accessible and updated in the database management system. There are four types of data models: Hierarchical model, Network model, Entity-relationship model, Relational model. These models have further categories which are used according to a different use case.
Different Types of Data Models
There are 4 different types of data models:
1. Hierarchical Model
In this type of data model, the data is organized into a tree-like structure that has a single root and the data is linked to the root. In this model, the main hierarchy begins from the root and it expands like a tree that has child nodes and further expands in the same manner. In this model the child node has on;e single parent node but one parent can have multiple child nodes. As the data is stored like tree structure in this data model when data is retrieved the whole tree is traversed from the root node. The hierarchical data model contains a one-to-many relationship between various types of data. The data is stored in the form of a record and is connected through links.
For Example- there is an organization that has a requirement to store the information of its employees. The table contains the following attributes: employee name, employee code, department name, and last name. And the organization provides a computer for each employee. So there is a requirement for storing information on a computer which is stored in a separate table. The computer table store employee code, serial number, and type. According to the hierarchical data model, the employee table can be considered as a parent table and a computer table can be considered as a child node.
2. Network model
The network model is a type of database model which is designed based on a flexible approach for representing objects and the relationship exist among objects. The schema is very important in the network data model which can be represented in the form of a graph where a relationship is represented using edges and the nodes are used to represent objects. The basic difference between the hierarchical model and network model is that data is represented in the form of hierarchy in a hierarchical data model whereas in network model the data is represented in the form of a graph. One of the advantages of a network model is that the basic connections are also represented in this data model. There are different types of relationship can exist in this data model like one to one, many to many, etc. The data access becomes simple to compare to other data model like the hierarchical model. The parent node and child node are always connected as there is always a relationship exist among parent-child node. And the data is not dependent on the other node. One of the key drawbacks of this model is that this system is not adaptive toward changes. It means when there is a requirement of some modification of system it requires to change the whole system which takes a lot of effort. And to maintain data is difficult to part in this model as every record is connected via some pointers which makes it difficult to maintain and make the system complex.
3. E-R model
The ER model is used to describe the database structure using the entity-relationship diagram. The E-R model is just like the blueprint of a database which is used to implement the database. In the entity set, the relationship exists which can be shown using the ER diagram. The entity set consists of a similar type of entities that consist of attributes.
The components of the ER model are relationship set and entity set and attributes. The entity is the component of data which is represented as a rectangle in the ER diagram. For example, there are two entities college and student and there exist one too many relationships as there can be more than one student who can go to college.
The entity which cannot be identified by attributes and which require a relationship is called a weak entity. For representing a weak entity the entity is represented in a double rectangle. For example, there is a bank account but it cannot relate until the bank name is not known to the bank account is termed as a weak entity.
The attributes are used to represent the property of the entity. In the ER diagram, the attribute is represented as an oval. There are different types of attributes like key attribute, composite attribute, multivalued attribute and derived attribute. For example, a student is an entity and the related attributes for student entity are student name, student age, student roll number, student address, etc.
The relationship is represented in a diamond shape in the ER diagram. The relationships exist among entities. There are multiple types of relationships like one to one, one to many, many to one, and many to many.
4. Relational model
In this data model, the data tables are used to collect a group of elements into the relations. In this model, the relationships and data are represented using interrelated tables. And in the table, there are multiple rows and multiple columns in which column represents the attribute of the entity and the rows are used to represent records. In this data model there exist different primary key which issued to distinguish each record in the table. And for retrieving the data elements the SQL (Structured Query Language) is used. For using the relational data model the primary key issued as the fundamental tool. And for each entry in the data set, it needs to be unique. The data table should not contain any type of inconsistency as it can create a problem at the time of data retrieval. The other problem with the relational data model is data duplicacy, incomplete data and inappropriate links used to connect data.
For representing the database there is a different type of data models which are used for representing database structure. Each data model has its advantage and disadvantage and the use of a data model is dependent on the use cases.
This is a guide to the Types of Data Model. Here we discuss the basic concept with different Types of Data Models and categories that are used according to a different use case. You may also look at the following article.
- Data Models in DBMS
- What is Data Modeling?
- Data Modeling Interview Questions
- Hierarchical Database Model