Data Models In DBMS: Types, Uses And More!
Database models illustrate the logical structure of a database and the relationships and constraints that determine how data can be accessed and stored. They are designed based on whatever broader data model the designers adopt. As a model of reality, it represents objects and events of the real world, as well as their relations.
The data model is used to describe the way information is stored and retrieved from a database. It also defines the rules by which the database will operate.
Let's now understand the meaning, role and types of data models in DBMS.
What is a Data Model in DBMS?
A data model can be defined as an integrated collection of concepts describing and manipulating data, as well as constraints on the data within an organization.
A data model is not just a set of tables; it is a conceptual representation of physical data stored in the database.
For example, if you have a table with a column for each employee's name, then there are many possible ways to represent this information: as one row per employee, or as multiple rows per employee (one row per department), or as multiple rows per person (one row for each job title). Each of these models has its own strengths and weaknesses.
Designing a Data Model
The first step in designing a data model is to define what kind of data you want to store in your database. This usually involves defining the entities involved in your application. An entity is any object that exists independently of anything else. You might think about an entity as something like a "person" or an "address."
Once you've identified all the entities, you need to decide how they relate to each other. In most cases, the answer to this question depends on what type of business process you're modelling.
The next step is to figure out how those entities will interact with each other. In some applications, you may want to create a single table to hold all the data about a particular entity.
However, you could also use several tables, where each table holds only part of the data about an individual entity. In addition, you should consider whether you'll need to perform queries across more than one table. If so, you'll probably need to link them together using foreign key columns.
Once you know the basic structure of your data model, you can start thinking about how best to organize it into tables. There are two main approaches: relational databases and hierarchical databases:
- Relational databases are organized around a set of tables that share common fields.
- Hierarchical databases are organized around a tree-like structure called a hierarchy.
Both approaches allow you to build complex structures quickly, but they do so at the cost of flexibility.
Why use Data Models?
Data models are extremely useful for any organization as they let business users directly define core business rules. As a result, fewer revisions are required during implementation. It also leads to significant reductions in development time, allowing businesses to deliver new businesses and projects faster.
Overall, the advantages of using data models can be summed up briefly in the following way:
1. Helps to cut costs and deliver products faster
2. It improves business processes significantly
3. Reduces complexity and risks in data handling
Now, let's discuss the various types of data models in DBMS in detail.
Types of Data Model in DBMS
There are a variety of models for data. Some of the most well-known models include:
- A Hierarchical model
- Network model
- Model of Entity-Relationship
- Relational Model
- Object-Oriented Data Model
- Object-Relational Data Model
- Semi-Structured Data Model
- Associative Data Model
- Flat Data Model
- Context Data Model
You can describe your database using any of these based on different variables. The most important thing to consider is the degree to which the database management software that you're using is compatible with specific models. The majority of database management systems are designed with a specific database model and will require users to follow that model; however, some support multiple models.
Furthermore, different models can be applied to various stages of the design process for databases. High-level conceptual data models are the best way to map out relationships between data in a way that people can see the data. Logical models based on records, however, are more closely reflected in how the data is stored at the data server.
When choosing a data model, it's equally about setting your priorities in relation to the database and the strengths of a specific model, regardless of whether your goals are speed, cost savings, usability, or something different.
Let's take a glance at the top popular database models.
1. Hierarchical Data Model
The hierarchical data model was the first DBMS-based model. This model organizes data in a hierarchical tree structure. The hierarchy begins at the root, which contains root data. It then expands into a tree, adding child nodes to the parent node. This model can easily represent real-world relationships, such as sitemaps, food recipes, or website navigation.
Characteristics of Hierarchical Model:
- One-to-many relationships: Here, the data is organized in a tree-like manner with a one-to-many relationship between data types. There can only be one path from any parent to any node.
- Parent-Child Relationship Every child node has its parent node, but a parent can have more than one child. Multiple parents are prohibited.
- Deletion Issue: When a parent node has been deleted, the child node will also be deleted.
- Pointers: Pointers link the parent and child nodes. They are used for navigation between stored data.
Example: The visual representation of the basic concepts of the database schema is shown below, where the college node points to two other nodes, the department and the infrastructure. This example is explained by taking real-world entities.
The Advantages of the Hierarchical Model
- It's very easy and quick to navigate through a tree-like structure.
- Changes in the parent node are automatically reflected in child nodes, so data integrity is maintained.
- Easy to find the difference.
The Disadvantages of the Hierarchical Model
- Complex relationships cannot be supported.
- It does not support more than one parent of the child node. If there is a complex relationship where a child node requires two parent nodes, it cannot be represented with this model.
- The child node will be deleted automatically if a parent node has been deleted.
2. Network Model
This model is an extension of the hierarchical one - allowing for many-to-many relationships. Thus a record can have more than one parent in this model. This model was the most well-known before the relational one. This model replaces the hierarchical trees with a graph.
Example: In this example, we can see that all three child nodes (employee, customer and product) are connected to Vendor and Sales Transaction. In the hierarchical structure, this was not possible.
Characteristics of Network Model
- Ability To Merge More Relationships: In this model, data is more closely related to more relationships. This model can manage both one-to-one and many-to-many relationships.
- Many routes: Because there are many relationships, multiple paths to the same record may exist. This allows data access to be quick and easy.
- Circular Link List: The operations on the network model can be done using the circular linked list. A program maintains the current position and navigates through the records based on the relationship.
The Advantages of the Network Model
- Data can be accessed more quickly than the hierarchical model. Because the data in the network model is more closely related, it is possible to take more than one route to reach a particular point. Thus, the data can be accessed faster and in many different ways.
- Data integrity is guaranteed because there is a parent/child relationship. Any changes in the parent record are reflected in a child record.
The Disadvantages of the Network Model
- The system can become more complicated as more relationships are needed to be managed. To use the model, the user must have a good understanding of it.
- Any change, such as updating, deletion, or insertion, is extremely complex.
3. Entity-Relationship (ER) Data Mode
Entity-Relationship Data Model is a high-level diagram of a data model. This model shows the real-world problem in a pictorial format to make it easier for stakeholders to understand.
DBMS - ER Model diagram makes it easy for developers to see the system. The E-R model Diagram is used to show an ER Model or domain model. The following components make up the ER Diagram:
- Entities: A real-world thing is an entity - it could be a person, a place, or even an idea. Examples: Students, Teachers, Courses, Buildings, Departments, etc., are all examples of entities that make up a School Management system.
- Attributes: An entity can contain a real-world property called an attribute. Example: An entity student owns the property, student ID and age, etc. In the ER Model diagram, an ellipse shape is used to represent attributes.
- Relationship: Relationship shows how two attributes are related. Example: A student working in a department. In the ER Model diagram, a diamond or rhombus shape represents the relationship.
Characteristics of the ER Model
- Graphical representation for better understanding: It's very simple and easy to understand, so developers can use it to communicate with stakeholders.
- ERD Diagram: The ERD diagram is used to represent the model visually.
- Design of a Database: Database designers use this model to create a database.
Advantages of the ER Model
- Easy: Conceptually, an ER Model can be very simple to create. The ER Diagram can be easily created if we know the relationships between the entities and attributes.
- Effective Communication Tools: Database designers use this model to communicate their ideas.
- Conversion to Any Model: This model is compatible with the relational model. It can easily be converted to a relational model by converting ER to the table. In fact, this model can be easily converted to any model, such as a hierarchical or network model.
Disadvantages of the ER Model
- There is no industry standard in notation: Developing an ER model according to industry standards is impossible. One developer may use notations that aren't understood by others.
- Hidden Information: Some information might be lost or hidden within the ER model. Some information may be lost or hidden because it is a high-level view.
4. Relational Model
The relational model is the most popular model. It is a model where the information is stored as two-dimensional tables. All information is stored in rows and columns. The foundation of a relational model is tables. Therefore, the tables are known as relations within the model.
Characteristics of the Relational Model
- Tuples: Each row within the table is known as the tuple. Each row is comprised of all the details regarding any particular specific instance. In the following example, each row is filled with all the information regarding a specific person - the first row contains information regarding Neha.
- Field or attribute: Attributes are the property that defines the table or relationship. The attributes' values must be within that same domain. In the following example, attributes are the aspects of a student such as Roll_no, Age, Address, etc.
Names | Roll_No | Phone_No | Address | AGE |
Neha | 98098 | 7305758990 | Varanasi | 20 |
Narayan | 12830 | 8026288936 | Delhi | 10 |
Amit | 330989 | 8583289090 | Bihar | 16 |
Khushi | 2785790 | 708687878 | Patna | 14 |
Ganesh | 17282 | 902893988 | Bangalore | 23 |
Advantages of the Relational Model
- Basic: This database model is less complex than the network and hierarchical models.
- Scalable: This model can scale easily to add as many columns and rows as a user may like.
- Structural Independence: It is possible to alter the structure of the database without altering the method for accessing the information. If we can modify the database structure without changing the ability of DBMS to access data, we can claim that structural independence is attained.
Disadvantages of the Relational Model
- Hardware Overheads: This model calls for more powerful hardware computers and devices for storing data to conceal the complexity and make it easier for the user.
- Poor Design: Because the model is extremely easy to create and utilize, users don't have to understand how data is stored for them to gain access to it. This simplicity of design could cause the development of a bad database, which could slow down as the database expands.
However, these issues are insignificant compared to the benefits of the relationship model. The problems could be prevented with the proper implementation and management.
5. Object-Oriented Database Model
Object-oriented database models combine both data and the relationship in a single structure referred to as an object. It is possible to store images, audio, videos, and more in databases that were not possible with the relational model (although you could save video and audio in a relational database, it is advised not to store them in relational databases).
In this case, the model has additional objects linked by hyperlinks. This link is used to connect one object to another object. Let’s study the following example to understand the concept better.
In the example above, we have two objects (Employee and Department). All the data is contained in a single unit (object), including their attributes like name, job_title, etc. for employees and dept_ID, dept_Name, for department. These two objects are linked because of the one common attribute they share - the Department_Id. The communication between the two objects is done through this common identification. This is the representation of the physical model of the Object-oriented data model.
Advantages of Object-Oriented Database Models (OODBs)
- Natural Modeling: OODBs excel at representing real-world entities and their relationships.
- Complex Object Handling: OODBs can handle complex data types beyond simple scalar values. They can store multimedia content, documents, and other intricate data structures within objects.
Disadvantages of Object-Oriented Database Models (OODBs)
- Limited Adoption: OODBs haven't achieved the same level of widespread adoption as relational models. This can lead to a smaller pool of developers experienced with OODB management systems and potentially limit the choice of tools and resources available.
6. Object-Relational Model
It is a mix of the relational model and object-oriented model. This model was designed to bridge the gap between object-oriented and relational models.
It has several advanced features, such as creating complicated data types based on our needs using available data types. The issue with this particular model is that it is often complicated and challenging to manage. Therefore, a thorough understanding of the model is necessary.
7. Semi-Structured Model
A semi-structured model is a modified version of the relational model, allowing for greater flexibility in representing data. It is impossible to distinguish between schema and data in this model because this model is based on the assumption that certain entities might have attributes that are missing. In contrast, other entities may include an additional attribute.
Example: An online news website stores information about news articles. The fixed attributes can be in the Authors Table (Article ID, Title, Author ID, Publication Date) and Articles Table (Author ID, Name, Bio). However, the news website might also want to store additional information about each article that doesn't fit neatly into predefined columns. This could include:
- A list of relevant keywords (tags) for better searchability.
- Links to related articles.
- Social media reactions (likes, shares) associated with the article (if applicable).
- Geolocation data if the article is about a specific location.
This additional information can be represented in a semi-structured format.
Remember! Semi-structured models are not a replacement for relational models, but rather a complementary approach for handling data that doesn't fit neatly into predefined tables and columns.
8. Associative Data Model
An associative model or Associative Data Model (ADM) is a model with the data divided into two components - entity and association. Everything with an independent existence is termed an entity, and the relation between the entities is called a connection or association.
The data is further divided into items and links:
- Items: An item contains a name and an identifier (specific numerical value).
- Link: The link comprises the source, verb, subject, and unique identifier.
It’s a more intuitive way of representing entities with an inherent relationship. Think of it as a way to model data that captures the "who connects to whom" directly within the entities themselves.
Example: A library keeps track of books and authors.
Items:
- Item Name: Book
- Identifier: book_id (unique identifier for each book, could be a number or code)
- Name: title (title of the book)
- Item Name: Author
- Identifier: author_id (unique identifier for each author)
- Name: full_name (author's full name)
Links:
- Link Identifier: link_id (unique identifier for each link)
- Source: book_id (references the book identifier)
- Verb: written_by (describes the relationship)
- Subject: author_id (references the author identifier)
Explanation:
- We have two items: "Book" and "Author," each with an identifier and a name attribute.
- Links connect these items. A link has its own identifier, specifies the source item (book), the verb describing the relationship ("written_by"), and the subject item (author).
Example Data:
- Book:
- book_id: 123
- title: "The Lord of the Rings"
- Author:
- author_id: 456
- full_name: "J.R.R. Tolkien"
- Link:
- link_id: 789
- source: 123 (book_id)
- verb: written_by
- subject: 456 (author_id)
This example shows how the associative model captures the relationship between books and authors using items and links. By following the links, you can easily see which author wrote a particular book.
The associative data model focuses on representing real-world entities and their direct relationships, often in a single structure. Unlike relational models with separate tables, it emphasizes the connections between things.
9. Flat Data Model
A flat data model is a very basic way of storing data in a database management system (DBMS). It's like a simple spreadsheet with rows and columns. Imagine a single table with columns representing different data points (like name, age, etc.) and rows representing individual records (like entries for each customer).
Think of it as a flat list with no hierarchy or connections between entries. It's a good starting point for simple data storage, but for anything more complex, relational models (with tables linked through relationships) are more efficient.
10. Context Data Model
The context data model is a collection of a variety of models. It is comprised of models such as network models, object-oriented data models, relational models, etc. With this model, we can accomplish various tasks that aren't achievable using just one model.
By understanding the strengths and weaknesses of different data models, you can make informed decisions when designing and implementing your database, ensuring optimal data storage, retrieval, and manipulation. As the data landscape continues to evolve, the development of new data models and advancements in existing ones will be crucial for effectively managing and unlocking the potential of information in the digital age.
Frequently Asked Questions
1. What are the different types of data models in DBMS?
DBMS has three main types of data models: hierarchical, network, and relational. Each type organizes data differently to facilitate efficient storage and retrieval.
2. What is a hierarchical data model?
A hierarchical data model organises data in a tree-like structure with parent-child relationships. This model is best suited for representing one-to-many relationships and is commonly used in systems like XML databases.
3. What is a network data model?
In a network data model, data is organized in a more complex structure with many-to-many relationships. This model allows more flexibility in representing data relationships than the hierarchical model.
4. What is a relational data model?
A relational data model organizes data into tables with rows and columns; each table represents an entity and each row represents a record. This model is widely used in modern database systems like MySQL and PostgreSQL.
5. Which data model is best for my business needs?
The best data model for your business needs depends on the complexity of your data relationships and the type of queries you need to perform. Consider consulting with a database expert to determine the most suitable data model for your specific requirements.
6. What factors influence the choice of data model?
Here are the four factors that influence the choice of data model:
- Type of data (structured, unstructured, semi-structured)
- Scalability requirements (relational vs NoSQL for large datasets)
- Performance needs (query speed and efficiency)
- Complexity of relationships between data entities
You might also be interested in reading:
Comments
Add commentLogin to continue reading
And access exclusive content, personalized recommendations, and career-boosting opportunities.
Abdi edo Geleto 2 months ago