0% found this document useful (0 votes)
35 views25 pages

DBMS M1 - Part 2 (FYIT)

DBMS

Uploaded by

shuklanandlal2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views25 pages

DBMS M1 - Part 2 (FYIT)

DBMS

Uploaded by

shuklanandlal2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

DATABASE MANAGEMENT

SYSTEM (DBMS)

Part 2 : Data Models


DATA MODEL
A collection of conceptual or logical tools that is used to describe the following is
called as data model.
• the data
• the relationships of data
• the meaning of data
• the consistency conditions or constraints

A data Model in Database Management System (DBMS) is the concept of tools that are
developed to summarize the description of the database. Data Models provide us with a
transparent picture of data which helps us in creating an actual database. It shows us from
the design of the data to its proper implementation of data.

The data models collectively grouped into the major groups like ‘Object based conceptual
Models’ and ‘Record based conceptual models.
Importance of Data models
Data models are crucial in the design and management of databases for several reasons:
1. Foundation for Database Design
- Blueprint: Data models provide a blueprint for how data is organized, stored, and retrieved in a
database. They define the structure, relationships, and constraints, ensuring that the database
design aligns with the real-world requirements of the application.
-Consistency: By adhering to a well-defined data model, databases maintain consistency in how
data is structured, leading to more reliable and predictable outcomes.

2. Facilitates Communication
- Common Language: Data models serve as a common language between different stakeholders,
such as developers, database administrators, and business analysts. They help in clearly
communicating the data requirements and how they should be implemented.
- Requirement Gathering: During the initial phases of database design, data models help in
gathering and documenting requirements, making sure that all aspects of the business logic are
captured accurately.

3.Enhances Data Integrity and Quality


- Constraints: Data models define constraints like primary keys, foreign keys, and other rules that
enforce data integrity, ensuring that the data stored in the database is accurate and reliable.
- Normalization: Through normalization, data models help in organizing data efficiently,
reducing redundancy and improving data quality.
4. Improves Query Performance
- Optimization: A well-designed data model enables efficient querying and data retrieval by optimizing the structure
for common queries and use cases.
- Indexing: Data models help in deciding where and how to implement indexes, which can significantly boost query
performance.

5. Supports Scalability
- Growth Management: As the database grows, a solid data model helps in managing and scaling the database
efficiently, ensuring that it can handle increased load and data volume without significant performance degradation.
- Modularity: Data models can be designed in a modular fashion, allowing parts of the database to be scaled
independently as needed.

6.Foundation for Database Maintenance and Evolution


- Flexibility: Data models provide a framework that can be evolved over time as business needs change. They make it
easier to modify the database structure without compromising existing functionality.
-Documentation: A clear data model acts as documentation, helping new developers and administrators understand
the database structure quickly and make informed decisions.

7. Ensures Compliance and Security


- Regulatory Compliance: Data models can be designed to ensure that data storage and handling comply with
industry regulations and standards, such as GDPR, HIPAA, or PCI-DSS.
- Security: By defining access controls and data partitioning within the data model, sensitive data can be protected
from unauthorized access.
BASIC BUILDING BLOCKS
In Database Management Systems (DBMS), data models define how data is structured, stored,
and manipulated. The basic building blocks in DBMS data models are essential elements that
provide the foundation for representing data in a structured way. These building blocks vary
slightly depending on the type of data model (e.g., relational, hierarchical, etc.), but generally,
they include the following:
1. Entities:Objects or concepts represented in the database.
Examples: `Student`, `Course`, `Professor`.
Purpose: Entities form the core of the data model, representing real-world objects that the
database tracks.
2. Attributes: Characteristics or properties of an entity.
Examples: `StudentID`, `Name`, `Address`, `DateOfBirth`.
Purpose: Attributes describe details about each entity, providing specific information like names or
dates.
3. Relationships: Relationships describe how entities are associated with one another. They
represent the connections or associations between entities.
Examples: `Student` enrolls in `Course`, `Professor` teaches `Course`.
Purpose: Relationships illustrate how different entities interact, crucial for linking related data
across the database.
4. Constraints:Constraints are rules that enforce the integrity of the data in the
database. They ensure the correctness and validity of the data.
Types:Primary Key Constraint: Ensures each record is unique.
Foreign Key Constraint:Maintains referential integrity between tables.
Not Null Constraint: Ensures that certain fields cannot be left empty.
Unique Constraint: Ensures all values in a column are distinct.
Purpose : Constraints enforce rules that protect data accuracy and consistency.

5. Keys:Keys are special attributes or sets of attributes used to identify records


uniquely or to establish relationships between tables.
Types:Primary Key: A unique identifier for each record in a table.
Foreign Key: An attribute that creates a link between two tables.
Composite Key: A combination of two or more attributes used as a key.
Candidate Key: Any attribute that could serve as a primary key.
Purpose: Keys ensure that each record can be uniquely identified and that
relationships between tables are accurately represented.
6. Schemas: A schema is the overall structure of the database, describing how data is
organized and the relationships between entities. It is a blueprint of the database.
Examples: Definitions of tables, columns, and relationships.
Purpose: Schemas provide a blueprint for how data is organized and interrelated within
the database.

7. Data Types: Data types define the kind of data that can be stored in an attribute.
Examples: `Integer` for whole numbers, `Varchar` for variable-length text, `Date` for date
values, `Boolean` for true/false values.
Purpose: Data types ensure that attributes store data in the correct format and prevent
invalid data from being entered.

8. Indexes: An index is a data structure that improves the speed of data retrieval
operations on a database table.
Examples: Indexes on columns like `StudentID` or `LastName` to speed up search
operations.
Purpose: Indexes optimize query performance, allowing faster access to data without
scanning the entire table.
OBJECT BASED CONCEPTUAL MODELS
Object based conceptual models are used to describe the data model at the logical
view level and external view levels.
• These types of models are flexible enough to explain the structuring capabilities.
• The data conditions of consistency are explicitly specified in addition to the
structuring of data.
• The object based conceptual models include: ER (Entity Relationship) Model and
Object-Oriented Model.
Types of Object-Based Conceptual Models: 1.ER MODEL

In this database model, relationships are created by dividing


object of interest into entity and its characteristics into
attributes.
▪ Different entities are related using relationships.
▪ E-R Models are defined to represent the relationships into
pictorial form to make it easier for different stakeholders to
understand.
▪ This model is good to design a database, which can then be
turned into tables in relational model
▪ Let's take an example, If we have to design a School
Database, then Student will be an entity with attributes name,
age, address etc.
ER Model
Advantages Disadvantages
• EFFECTIVE : It is an effective communication tool. • Complexity with Large Systems: Can become
• USEFUL IN DECISION MAKING : Since some of the complicated with very large databases.
entities in the database are analyzed by an ER- • Limited Detail for Some Needs: Not as detailed
Diagram, So by drawing an ER-Diagram we come to as some other models for specific applications.
know what kind of attributes and relationship exist
between them. • Lacks Physical Design Information: Doesn't
specify physical storage details or performance
• Clear Representation: Visual representation of data considerations.
that's easy to understand for all stakeholders.
• Adaptation Required for Different DBMS:
• Conceptual Simplicity: Simple to construct and Needs to be translated to specific DBMS models.
communicate.
• Flexibility: Easy to make changes during the design
• Static Nature: It can be rigid and doesn't easily
process. adapt to changes in business requirements.

• Normalization Support: Helps identify and reduce


data redundancy.
• Documentation: Provides thorough documentation
for the database structure.
2. OBJECT ORIENTED MODEL
The Object-Oriented Model in DBMS or OODM is the data model where data is stored in the
form of objects. This model is used to represent real-world entities. The data and data
relationship are stored together in a single entity known as an object in the Object Oriented
Model. The Object-Oriented Database Management System is built on top of Object Oriented
Model.
Example
Now let us consider an example given below.
● Here Transport, Bus, Ship, and Plane are objects.
● Bus has Road Transport as the attribute.
● Ship has Water Transport as the attribute.
● Plane has Air Transport as the attribute.
● The Transport object` is the base object and
the Bus, Ship, and Plane objects derive from it.
Advantages of Object-Oriented Data Model
● It is used to add semantic content that can be well understood by the user.
● It is used to make the code resemble real-world objects.
● Database integrity can be achieved.
● Structural and database independence is created.
● We can store pictures, audio, video, and other types of data, which was
previously impossible to store earlier.
Disadvantages of Object-Oriented Data Model
● It has complex navigational data access.
● There is a steep learning curve here.
● The transactions might be slow here.
RECORD BASED CONCEPTUAL MODELS

This type of data models is also used to describe the data at conceptual (logical)
and view levels. The implementation details are provided at physical levels.
• Different types of records in respective format are structured to form a
database.
• As the database is a collection of such record formats this data model is called
as record-based conceptual model.
• The models which come under record based conceptual models list are
Hierarchical, Network and Relational model. Among these three models the
Relational Model is most widely accepted data model.
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.
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.
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. 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 Aryan.
• 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 Name, Age,
Gpa, etc.
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.
Advantages of Data models
1. Simplicity: Since the database is based on the hierarchical structure, the
relationship between the various layers is logically simple.
2. Data Security: Hierarchical model was the first database model that
offered the data security that is provided by the DBMS.
3. Data Integrity: Since it is based on the parent child relationship, there is
always a link between the parent segment and the child segment under it.
4. Efficiency: It is very efficient because when the database contains a large
number of 1:N relationship and when the user require large number of
transaction.
Disadvantages of Data models
1. Implementation complexity: Although it is simple and easy to design, it is
quite complex to implement.
2. Database Management Problem: If you make any changes in the database
structure, then you need to make changes in the entire application program
that access the database.
3. Lack of Structural Independence: there is lack of structural independence
because when we change the structure then it becomes compulsory to change
the application too.
4. Operational Anomalies: Hierarchical model suffers from the insert, delete and
update anomalies, also retrieval operation is difficult.

You might also like