0% found this document useful (0 votes)
6 views

DBMS Unit 1

Uploaded by

jixefej261
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

DBMS Unit 1

Uploaded by

jixefej261
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

Dr.

Shweta

DBMS Unit 1 (Overview)

Definition:-
A Database Management System (DBMS) is software that interacts with end users,
applications, and the database to capture and analyse data. It allows for creating, querying,
updating, and administrating databases.

Why Do We Need DBMS?

Imagine you have a large collection of books at home. To find a specific book, you might
need to go through each one until you find the right one. Now, think about a library where
books are organized systematically. You can search by title, author, or genre, making the
process much quicker and more efficient. A DBMS is like the librarian—it helps you
organize, manage, and retrieve data efficiently.

Real-Life Example:

Consider a school with hundreds of students. The school needs to keep track of each
student's details, such as name, age, grades, and attendance. If all this data were stored in
individual files, it would be cumbersome to manage. With a DBMS, the school can store all
the data in a structured format, making it easy to update, retrieve, and analyze.

1
Dr. Shweta

File System
A File System is a method and data structure used by an operating system to manage files on
a storage device, such as a hard drive or SSD. It determines how data is stored, retrieved, and
organized.

Types of File System:

● FAT (File Allocation Table): One of the oldest file systems, FAT was developed by
Microsoft for early versions of Windows. Variants include FAT12, FAT16, FAT32, and
exFAT. Used in portable storage devices like USB drives, memory cards, and older
operating systems. Real-Life eg :Think of FAT as a simple filing cabinet. Each drawer
(cluster) can hold a limited amount of paper (data), and there’s a master list (file
allocation table) that keeps track of where each document (file) is stored.
● NTFS (New Technology File System): NTFS is a proprietary file system developed
by Microsoft, introduced with Windows NT. It’s the default file system for modern
Windows operating systems. Used in Windows operating systems, internal hard
drives, and SSDs in Windows PCs. Real-Life eg: NTFS is like a high-tech office
filing system. It not only stores documents but also tracks who can access them,
compresses files to save space, and keeps logs to ensure nothing gets lost or damaged.
● ext (Extended File System): The ext family includes ext2, ext3, and ext4, with ext4
being the most widely used in Linux operating systems. The default file system for
most Linux distributions is used in servers and desktops running Linux. Real-Life eg:
ext is like a well-organized library catalogue system. It ensures that books (files) are
well-indexed, can handle a large collection, and maintains a log (journal) to prevent
loss during unexpected events.
● NFS (Network File System): NFS is a distributed file system protocol developed by
Sun Microsystems that allows users to access files over a network as if they were on
their local storage. Commonly used in enterprise environments to allow users to
access shared files from a centralized server. Real-Life eg: NFS is like having a
shared office network drive that everyone in the office can access, regardless of their
computer’s operating system.

How File Systems Work

2
Dr. Shweta

A file system is responsible for organizing data on a storage medium. Here's a simplified
view of how it works:

1. File Creation: When a file is created, the file system allocates space on the storage
device and records the location of the data blocks. It also stores metadata like the file
name, size, and creation date.
2. File Access: When you open a file, the file system locates the data blocks based on
the metadata and loads the file into memory.
3. File Modification: When you modify a file, the changes are written back to the
storage medium. The file system updates the metadata and ensures data integrity.
4. File Deletion: When you delete a file, the file system marks the space as available for
new data but doesn’t immediately erase the data. This is why deleted files can
sometimes be recovered.
5.

Difference Between File System and Database System


A file system deals with files on a device. (eg. Windows File Explorer.
A database organizes data in a structured format. (e.g. A customer list with names and
addresses.)
A DBMS provides the tools to manage and interact with databases. (eg. MySQL, Oracle)

Aspect File System Database System

Definition A File System is a method of A Database System is a software


storing and organizing files system that manages data using a
on a storage medium (like structured format, allowing for
hard drives, SSDs) that efficient querying, updating, and
allows for data storage and management of large datasets.
retrieval.

3
Dr. Shweta

Real life Imagine a library where Imagine a well-organized library where


example books are stored on shelves books are cataloged by title, author,
without any specific order. genre, and more. You can quickly
Each book is like a file, and search a database to locate exactly
you have to manually search where a book is, who has borrowed it,
each shelf to find what you or even generate a list of all books by a
need. specific author.

Data Storage Stores data as individual files Stores data in tables, with relationships
within directories, with no between data entities, allowing for
inherent structure beyond the structured data management.
file hierarchy.

Data Access Accessed through the file Accessed via queries using SQL
name and directory path, (Structured Query Language) or other
often manually or with simple query languages, allowing complex
programs. operations on data.

Data Integrity Limited mechanisms for Provides strong data integrity with
ensuring data consistency and ACID (Atomicity, Consistency,
integrity, often relying on the Isolation, Durability) properties,
user or application to manage ensuring reliable transaction
this. processing.

Data High risk of data redundancy, Reduces data redundancy through


Redundancy as the same data might be normalization, where data is organized
stored in multiple files in a way that minimizes duplication.
without any coordination.

Concurrency Minimal or no support for Built-in mechanisms for handling


Control concurrent access control; concurrent access by multiple users,
conflicts may arise when preventing conflicts and ensuring data
multiple users try to access consistency.
the same file simultaneously.

4
Dr. Shweta

Security Basic security features, Advanced security features, including


typically at the operating user authentication, authorization, and
system level, such as file encryption, to protect data from
permissions. unauthorized access.

Scalability Less scalable; managing large Highly scalable, designed to handle


volumes of data can become large datasets efficiently, and capable
cumbersome, with slower of managing complex queries and large
access times and more user bases.
manual organization required.

Data No inherent capability to Manages relationships between data


Relationships manage relationships between entities naturally through keys
data entities; any (primary, foreign) and relationships
relationships must be (one-to-one, one-to-many,
managed by the application many-to-many).
or manually by the user.

Backup and Basic backup features, often Advanced backup and recovery
Recovery requiring manual features, often automated, with
intervention; recovery can be mechanisms to restore data to a
difficult and prone to data consistent state after a failure.
loss.

Query Limited querying capabilities, Powerful query capabilities using SQL,


Capabilities typically requiring manual allowing for complex data retrieval,
search or custom scripts. filtering, and manipulation.

Example Use Simple applications, file Business applications, customer


Cases storage, document relationship management (CRM)
management, personal file systems, banking, and financial
storage like documents, systems, large-scale data analytics.
images, and videos.

5
Dr. Shweta

Performance Can be faster for simple, Optimized for handling large datasets
sequential file access tasks. and complex queries but may have
overhead due to transaction
management.

Cost and Generally simpler and less Typically more complex and
Complexity expensive to implement and expensive, requiring specialized
maintain. software and expertise.

Database Systems
A Database System is a complex software system designed to manage, store, and retrieve
large amounts of structured data efficiently. It allows users and applications to interact with
the data through various operations such as querying, updating, and reporting. Database
systems are crucial in various domains, including business, finance, healthcare, and more.

Google's Database Size: Google processes over 3.5 billion searches per day, storing and
analyzing vast amounts of data in their custom database systems. Imagine the size and
complexity of their database architecture!

Types of Database Systems

1. Relational (RDBMS)
2. Hierarchical
3. Network
4. NoSQL
5. Object-Oriented

1. Hierarchical Database

Definition:
A hierarchical database organizes data in a tree-like structure, where each record has a single

6
Dr. Shweta

parent and can have multiple children. This model represents data in a hierarchy similar to an
organizational chart, allowing for one-to-many relationships.

characteristics:

● Tree Structure: Data is arranged in a parent-child relationship, forming a tree-like


hierarchy.
● One-to-Many Relationships: Each parent can have multiple children, but each child
has only one parent.
● Fast Data Access: Particularly efficient for data retrieval that follows the hierarchy.
● Rigid Structure: The predefined hierarchy can make it difficult to represent more
complex relationships.

Examples:

● IBM Information Management System (IMS): One of the earliest and most widely
used hierarchical databases, especially in mainframe environments.
● Windows Registry: A hierarchical database used in Microsoft Windows to store
configuration settings.

Real-Life Example:
Imagine a company's organizational chart. The company (root) has departments (children),
departments have teams (grandchildren), and teams have employees (leaves). Navigating
this structure is straightforward due to its hierarchical nature.

Interesting Fact:
Hierarchical databases were among the first types of databases to be developed and are still in
use today, particularly in legacy systems that require simple, predictable data relationships.

2. Network Database

Definition:
A network database organizes data using a graph structure, allowing more complex

7
Dr. Shweta

relationships than the hierarchical model. It supports many-to-many relationships by allowing


each child to have multiple parents.

Characteristics:

● Graph Structure: Data is represented as records connected by links, forming a


graph.
● Many-to-Many Relationships: Each record can have multiple parent and child
records.
● Flexibility: More flexible than hierarchical databases in representing complex
relationships.
● Complexity: The structure can be more complicated to design and navigate.

Examples:

● Integrated Data Store (IDS): An early network database system.


● TurboIMAGE: A network database used in VMS environments.

Real-Life Example:
Consider a university database where students can enrol in multiple courses, and each
course can have multiple students. The network model efficiently represents the
many-to-many relationship between students and courses.

Interesting Fact:
The network model was standardized as the CODASYL database model in the late 1960s,
which was influential in the development of later database systems.

3. Relational Database Management System (RDBMS)

Definition:
An RDBMS organizes data into tables (relations) consisting of rows and columns. It is based
on the relational model introduced by E.F. Codd in 1970.

8
Dr. Shweta

Characteristics:

● Tabular Structure: Data is stored in tables with rows (records) and columns (fields).
● Structured Query Language (SQL): Uses SQL for defining and manipulating data.
● Data Integrity: Enforces data integrity through constraints like primary keys, foreign
keys, and unique constraints.
● ACID Compliance: Ensures transactions are Atomic, Consistent, Isolated, and
Durable.
● Flexibility in Queries: Supports complex queries, joins, and transactions.

Examples:

● MySQL: Popular open-source RDBMS used in web applications.


● Oracle Database: Enterprise-level RDBMS known for robustness and scalability.
● Microsoft SQL Server: RDBMS widely used in enterprise environments, especially
those using Microsoft technologies.
● PostgreSQL: An open-source RDBMS known for its advanced features and
compliance with SQL standards.

Real-Life Example:
An online banking system uses an RDBMS to manage customer accounts, transactions,
loans, and other financial data. Tables like Customers, Accounts, Transactions, and Loans
are interrelated, allowing the bank to efficiently process and query data.

Interesting Fact:
Relational databases are the most widely used type of database systems in the world, forming
the backbone of many enterprise and web applications.

4. NoSQL Database

Definition:
NoSQL databases are non-relational databases designed to handle unstructured or

9
Dr. Shweta

semi-structured data. They offer flexible data models and are optimized for scalability and
performance, especially in distributed and large-scale environments.

NoSQL for Speed: NoSQL databases like MongoDB are used by companies like
Facebook and Twitter because they handle huge amounts of data faster than traditional
relational databases. This is crucial when dealing with millions of users posting updates
every second!

Characteristics:

● Flexible Schema: No fixed schema, allowing for the storage of various data types.
● Various Data Models: Supports document, key-value, column-family, and graph data
models.
● Scalability: Designed to scale horizontally across multiple servers.
● Performance: Optimized for fast read and write operations in large-scale
applications.
● Eventual Consistency: Some NoSQL databases prioritize availability and partition
tolerance over immediate consistency.

Example: MongoDB

Real-Life Example:
A content management system (CMS) like WordPress or a blogging platform may use a
NoSQL database like MongoDB to store posts, comments, and user profiles. The flexible
schema allows for rapid development and handling of varied types of data without a
predefined structure.

Interesting Fact:
The term "NoSQL" was coined in 1998 for a lightweight, open-source relational database,
but it has evolved to represent a broad category of non-relational databases designed for
modern applications requiring scalability and flexibility.

Comparison Table: Hierarchical, Network, Relational, and NoSQL Databases

10
Dr. Shweta

Feature Hierarchic Network Relational NoSQL


al (RDBMS)

Data Model Tree-like Graph structure Tables Various (document,


structure (relations) key-value, column,
graph)

Relationships One-to-man Many-to-many One-to-one, Depends on the


y one-to-many, type (e.g.,
many-to-many document databases
(via joins) may embed, graph
databases have
edges)

Schema Fixed, Flexible, but Fixed schema Flexible schema


predefined structured

Query Custom, Custom (e.g., SQL Varies (e.g.,


Language specific to CODASYL) MongoDB uses a
the system query language
based on JSON)

Scalability Limited Limited Vertical and Highly scalable


limited horizontally
horizontal

Use Cases Legacy Complex General-purpos Big data, real-time


systems, relationships e, enterprise web apps, flexible
configuratio (e.g., networks) apps data storage
n data

Examples IBM IMS, IDS, MySQL, MongoDB,


Windows TurboIMAGE Oracle, SQL Cassandra, Redis,
Registry Server Neo4j

11
Dr. Shweta

Advantages Simplicity, Flexible Data integrity, Scalability,


fast access relationships, powerful flexibility, high
for better for queries, ACID performance
hierarchical network-like compliance
data data

Disadvantages Inflexible, Complex Can be rigid, Lack of


difficult to structure, less requires standardization,
manage intuitive normalization varying consistency
complex models
relationship
s

Understanding the distinct types of database systems—Hierarchical, Network, Relational, and


NoSQL—enables you to choose the most suitable one for your specific needs:

● Hierarchical databases are ideal for applications with a clear, tree-like structure,
such as organizational charts or file systems.
● Network databases excel in scenarios requiring complex many-to-many
relationships, like telecommunications or transportation networks.
● Relational databases are versatile and widely used for structured data and
applications requiring robust transaction support, such as banking systems and
e-commerce platforms.
● NoSQL databases offer flexibility and scalability for modern applications dealing
with large volumes of unstructured or semi-structured data, such as social media
platforms and real-time analytics.

The First DBMS: The first-ever DBMS, called "Integrated Data Store" (IDS), was
created by Charles Bachman in the 1960s. This system is considered the
grandfather of modern DBMS and earned Bachman the prestigious Turing Award
in 1973.

Database Users

12
Dr. Shweta

In a Database Management System (DBMS), different types of users interact with the
database, each with specific roles, responsibilities, and levels of access. Understanding these
roles is crucial for effective database management, security, and ensuring that the database
meets the needs of all stakeholders. Here’s an overview of the main types of DBMS users:

1. Database Administrators (DBAs)

● Role: DBAs are the custodians of the database. They are responsible for the overall
management, maintenance, and security of the database.
● Responsibilities:
○ Database Design: DBAs design the database schema, defining tables,
relationships, indexes, and other structures to ensure data is stored efficiently.
○ Performance Tuning: They monitor and optimize database performance,
ensuring queries run efficiently and the system remains responsive.
○ Backup and Recovery: DBAs regularly back up the database to prevent data
loss and implement recovery procedures in case of system failure.
○ Security Management: They control access to the database by setting user
permissions, ensuring that only authorized users can access or modify data.
○ Software Maintenance: DBAs install updates, patches, and new versions of
the DBMS software as needed.
● Access Level: High-level access, including administrative control over the entire
database.

Illustration : Role: The Library Manager

● Example: The Library Manager oversees the entire library system. They
ensure the library's database is running smoothly, that only authorized staff
and students can access certain parts of the system, and that all data is
backed up regularly. If a new section is added to the library, like a digital
archives room, the Library Manager updates the system to include these
new resources.

In DBMS: The DBA manages the entire library database, ensuring it’s secure,

13
Dr. Shweta

up-to-date, and performing well.

2. Database Designers

● Role: Database designers, sometimes referred to as data architects, are responsible for
designing the database structure based on the needs of the organization.
● Responsibilities:
○ Schema Design: They define the database schema, determining how data will
be stored, organized, and related.
○ Normalization: They apply normalization techniques to reduce data
redundancy and ensure data integrity.
○ Modeling Relationships: Database designers create entity-relationship (ER)
diagrams and other models to visualize how different data entities relate to
each other.
○ Documentation: They document the database design, providing a blueprint
for implementation and future maintenance.
● Access Level: Design-level access, allowing them to define and modify the database
structure.

Role: The Library Architect

● Example: The Library Architect is responsible for designing how the library
database is structured. They decide how to organize information about books,
journals, and digital resources, and how different sections of the library relate to
one another. For example, they design the database so that each book is linked to its
author, subject, and availability status.

In DBMS: The Database Designer structures the database by defining tables, relationships,
and data flows within the library system.

14
Dr. Shweta

3. Application Developers

● Role: Application developers create software applications that interact with the
database. They write the code that enables users to access, modify, and manage data
through user interfaces.
● Responsibilities:
○ Writing Queries: Developers write SQL queries to retrieve, insert, update,
and delete data in the database.
○ User Interface Development: They develop front-end applications that
provide users with an easy way to interact with the database.
○ Integrating Databases: Developers integrate the database with other software
systems, ensuring smooth data flow between different applications.
○ Testing and Debugging: They test applications to ensure they function
correctly with the database and fix any bugs that arise.
● Access Level: Varies; typically, they have access to the database through APIs or
query interfaces, depending on the application’s requirements.

Role: The Library Software Developer

● Example: The Library Software Developer creates the online catalog that students
use to search for books and reserve them. They write the code that makes it possible
for a student to log in, search for a book, and see if it’s available. If the book is
checked out, the system allows the student to place a hold on it.

In DBMS: The Application Developer builds the software interface that connects the
library’s database with the users, enabling them to search and reserve books.

4. End Users

15
Dr. Shweta

● Role: End users are the individuals who interact with the database through
applications or interfaces designed by developers. They access the data to perform
specific tasks or retrieve information.

Role: The Students and Librarians

● Example: Students use the library’s online catalog to search for books, check if
they are available, and reserve them if necessary. Librarians use the system to
check books in and out, manage inventory, and assist students with their queries.

In DBMS: The End Users interact with the library database through the user interface
created by the Application Developer. Students search and reserve books, while Librarians
manage day-to-day operations.

Types of End Users

A. Casual Users
● Who They Are: Casual users interact with the database occasionally, often using it to
retrieve specific information or run predefined queries. They do not have deep
technical knowledge of the database.
● Example: A university administrator who occasionally checks the student database to
retrieve information on student enrollments or graduation statistics.
● Tasks:
○ Running Predefined Queries: They may use a simple search form to find
specific data.
○ Viewing Reports: Casual users often access reports generated by others rather
than creating their own.
● Level of Interaction: Low; they rely on user-friendly interfaces like dashboards or
simple search functions to access the database.

B. Naive or Parametric Users

16
Dr. Shweta

● Who They Are: These users interact with the database regularly as part of their job
but typically do so using applications specifically designed for their tasks. They do
not write SQL queries or understand the underlying database structure.
● Example: A bank teller using a banking application to process transactions, check
account balances, or update customer information.
● Tasks:
○ Routine Data Entry: Inputting data into the system, such as entering a new
customer's details.
○ Processing Transactions: Completing standard transactions like deposits,
withdrawals, or transfers using a specialized interface.
○ Using Standard Queries: Executing predefined operations that are embedded
in the application they use.
● Level of Interaction: Moderate; their work depends on interacting with the database,
but they do so through applications designed to make their tasks simple and error-free.

C. Sophisticated Users

● Who They Are: Sophisticated users are technically skilled individuals who
understand the database and can perform complex operations. They often include
analysts, engineers, and business professionals who need to manipulate data in
various ways.
● Example: A data analyst writing complex SQL queries to analyze sales data and
generate custom reports to identify trends.
● Tasks:
○ Custom Querying: Writing and running SQL queries to retrieve specific data.
○ Data Analysis: Using advanced tools to analyze large datasets and extract
meaningful insights.
○ Database Management: Some sophisticated users might perform tasks
related to database tuning or optimization, depending on their role.
● Level of Interaction: High; they have a deep understanding of the database and can
perform complex operations, often directly interacting with the database using query
languages like SQL.

17
Dr. Shweta

D. Standalone Users

● Who They Are: Standalone users work with personal or desktop databases that don’t
necessarily connect to a larger system. They manage their own small-scale databases
for specific needs, often using software like Microsoft Access or similar tools.
● Example: A small business owner using a local database to manage inventory and
sales records in their store.
● Tasks:
○ Database Creation: Setting up and managing their own database without
needing to interact with a central DBMS.
○ Data Entry and Querying: Inputting data and running queries directly on
their local database.
○ Simple Report Generation: Creating basic reports to analyze their own data.
● Level of Interaction: Variable; while they may not have deep technical knowledge,
they often manage all aspects of their database independently.

E. Application Users

● Who They Are: Application users interact with the database through specific
applications that hide the complexity of database operations. These applications are
designed to make tasks easy for users without requiring them to understand the
underlying database.
● Example: Employees using an HR application to submit leave requests, update
personal information, or check their payroll details.
● Tasks:
○ Using Predefined Functions: Application users typically perform tasks
defined by the application, such as submitting forms or generating standard
reports.
○ Limited Interaction: They interact with the database only through the
application's interface, which simplifies tasks and prevents errors.

18
Dr. Shweta

● Level of Interaction: Low to moderate; the application manages most of the


interaction with the database, making it easy for users to perform their tasks without
needing to understand how the database works.

● Access Level: Limited, typically restricted to specific tables, views, or operations


depending on their role.

5. System Analysts

● Role: System analysts bridge the gap between business requirements and the technical
implementation of the database. They ensure that the database meets the
organisation’s needs.
● Responsibilities:
○ Requirement Analysis: Gather and analyze business requirements to ensure
the database design aligns with organizational goals.
○ System Design: Work with DBAs and developers to design systems that
leverage the database effectively.
○ Documentation: Create detailed documentation of system requirements and
designs to guide development and maintenance.
○ User Training: Assist in training end users and other stakeholders in using the
database effectively.
● Access Level: Moderate, with the ability to view and analyze the database structure
and performance but not typically involved in direct database management.

Role: The Library Consultant

● Example: The Library Consultant works with the Library Manager to understand
the needs of both students and librarians. They gather requirements, like the need
for a faster search function or better tracking of overdue books, and ensure these
needs are addressed in the database system. They also suggest improvements, like

19
Dr. Shweta

integrating the library database with the university’s academic records system to
allow seamless access for students.

In DBMS: The System Analyst ensures that the library database system meets the needs of
all users and functions effectively within the university’s broader IT ecosystem.

6. Database Users with Special Roles

● Data Analysts/Data Scientists:


○ Role: These users focus on extracting valuable insights from the data stored in
the database. They often work with large datasets and perform complex
queries and analysis.
○ Responsibilities:
■ Data Mining: Identifying patterns and correlations in large datasets to
inform business decisions.
■ Reporting and Visualization: Creating visual representations of data
trends and insights.
■ Predictive Modeling: Using statistical methods and algorithms to
predict future trends based on historical data.
○ Access Level: High access to data, often with permission to run complex
queries and analysis.

Role: The Library Data Analyst

● Example: The Library Data Analyst examines usage patterns in the library system.
They analyze which books are most frequently borrowed, which subjects are in
high demand, and what times of the year the library is busiest. Based on this data,
they might recommend purchasing more copies of popular books or extending
library hours during exam periods.

20
Dr. Shweta

In DBMS: The Data Analyst uses the library’s database to extract and analyze data,
providing insights that help improve the library’s services.

In this university library system:

● The DBA (Library Manager) maintains and secures the database.


● The Database Designer (Library Architect) structures how information is organized.
● The Application Developer (Library Software Developer) creates the software
interface.
● The End Users (Students and Librarians) interact with the system for their needs.
● The System Analyst (Library Consultant) ensures the system meets everyone’s
requirements.
● The Data Analyst (Library Data Analyst) uses data to suggest improvements.

Advantages and Disadvantages of DBMS (Database


Management System)
A Database Management System (DBMS) is a software system that enables users to define,
create, maintain, and control access to the database. It plays a crucial role in modern data
management by providing an interface between users and databases. However, like any
technology, DBMS comes with its own set of advantages and disadvantages.

Advantages of DBMS

1. Data Integrity and Consistency


A DBMS ensures that data remains accurate, consistent, and reliable across the database.
By enforcing rules like constraints (e.g., primary keys, foreign keys), it maintains data
integrity, preventing issues like duplicate or inconsistent data.

21
Dr. Shweta

Example:
In a banking system, the DBMS ensures that account balances are consistently updated across
all related tables, preventing discrepancies during transactions.

2. Data Security
DBMS provides robust security features, allowing administrators to control access to the
database. It enables setting permissions and roles, ensuring that only authorized users can
access or modify specific data.

Example:
In a healthcare system, sensitive patient information is protected by limiting access to
authorized personnel, ensuring compliance with regulations like HIPAA.

3. Data Independence
DBMS provides data abstraction, meaning the data’s physical storage is separated from its
logical structure. This allows changes to the physical data storage without affecting the
application programs that access the data.

Example:
A retail management system can change the storage location of product data without altering
the application logic used for inventory management.

4. Improved Data Sharing

A DBMS enables multiple users to access and share data simultaneously in a controlled
manner. This promotes collaboration and ensures that all users work with the most up-to-date
information.

Example:
In a university, faculty members, administrators, and students can simultaneously access
course schedules and grades, with the DBMS managing concurrent access.

5. Backup and Recovery

DBMS systems provide automatic backup and recovery mechanisms, ensuring data is not lost
in case of system failure. They can recover data to a previous state using logs and backups.

22
Dr. Shweta

Example:
In case of a power outage, a company’s customer database can be restored to the last backup
point, minimizing data loss and downtime.

6. Data Redundancy Control

DBMS minimizes data redundancy (duplication) by centralizing data storage and eliminating
isolated data silos. This reduces the chances of inconsistencies and saves storage space.

Example:
Instead of storing customer details in multiple locations, a CRM system uses a single
database to store all customer information, ensuring that updates are reflected across the
system.

7. Enhanced Data Accessibility

DBMS systems provide query languages (like SQL) that allow users to easily retrieve and
manipulate data. This simplifies the process of accessing specific information and generating
reports.

Example:
A sales manager can quickly generate a report showing sales performance by running an SQL
query, rather than manually sifting through large volumes of data.

World's Largest Database: The World Data Centre for Climate (WDCC) in Germany
holds one of the world's largest databases, storing over 220 petabytes of climate data.
That's equivalent to the data stored in over 47 million DVDs!

Disadvantages of DBMS

1. Cost of Hardware and Software

Implementing a DBMS can be expensive due to the cost of the software itself, as well as the
need for specialized hardware to handle the system’s demands.

23
Dr. Shweta

Example:
An organization may need to invest in high-performance servers and storage solutions to
efficiently run an enterprise-level DBMS like Oracle or Microsoft SQL Server.

2. Complexity

DBMS systems can be complex to design, implement, and maintain. They require skilled
personnel, such as database administrators (DBAs), to manage and optimize the system.

Example:
A small business may struggle with the complexity of setting up a DBMS, requiring them to
hire or train staff to manage the system effectively.

3. Performance

DBMS systems can become a performance bottleneck, especially in high-transaction


environments. The overhead of managing concurrent access, maintaining data integrity, and
executing complex queries can slow down the system.

Example:
A large e-commerce platform might experience slower response times during peak shopping
periods due to the increased load on its DBMS.

4. Size and Storage

DBMS systems often require significant storage space, especially when dealing with large
volumes of data. The storage needs can escalate as more data is added over time.

Example:
A media company storing high-resolution videos in a DBMS may quickly exhaust available
storage, requiring frequent upgrades or expansions.

5. Need for Regular Maintenance

A DBMS requires ongoing maintenance, including updates, backups, and performance


tuning. This can be resource-intensive, requiring continuous attention from database
administrators.

24
Dr. Shweta

Example:
Regular maintenance tasks like indexing, query optimization, and backup scheduling must be
performed to ensure the smooth operation of a hospital’s patient management system.

6. Risk of Data Loss

Despite backup and recovery mechanisms, there is always a risk of data loss due to hardware
failures, software bugs, or human error. Recovery processes can sometimes be complex and
time-consuming.

Example:
If a backup process fails or is improperly configured, a retail company might lose critical
sales data, affecting their financial reporting.

7. Vendor Dependence

Organizations that use proprietary DBMS software can become dependent on the vendor for
updates, support, and new features. This can lead to challenges if the vendor discontinues the
product or increases costs.

Example:
A company using a specific version of Oracle DBMS might face difficulties if Oracle decides
to stop supporting that version, forcing the company to upgrade or switch to a different
system.

A DBMS offers numerous advantages, including improved data integrity, security, and
accessibility, making it a powerful tool for managing and utilizing data effectively.
However, these benefits come with potential drawbacks such as cost, complexity, and
maintenance requirements. Understanding these pros and cons is crucial for organizations
when deciding whether to implement a DBMS and selecting the right system to meet their
needs.

DBMS Architecture

25
Dr. Shweta

A Database Management System (DBMS) is like a sophisticated software that helps us


store, manage, and retrieve data efficiently. Imagine it as a librarian who knows exactly
where every book is in a huge library and can fetch it for you quickly. But how does this
"librarian" work? Let’s dive into the architecture of a DBMS to understand.
Definition: DBMS architecture refers to the layout of the components of a database
management system. It shows how the system is structured, how data flows through it, and
how the different parts of the system interact with each other. The most common DBMS
architectures are 1-tier, 2-tier, and 3-tier.

DBMS architecture is the blueprint that determines how a database system operates and
interacts with users. Whether it's the simplicity of 1-tier, the straightforward client-server
model of 2-tier, or the robust, scalable 3-tier architecture, each has its unique advantages
depending on the application's needs.

1-Tier Architecture:

In 1-tier architecture, the database is directly accessible by the user. This means the user
interacts directly with the DBMS, and both the data and the application reside on the same
machine.

Example: Imagine you're working on your personal computer, using a small database like
Microsoft Access or an Excel spreadsheet. Everything you need is right there on your
computer. This setup is simple but not suitable for large, complex systems with many users.

26
Dr. Shweta

Fact: 1-tier architecture is commonly used for single-user applications or when the database
size is relatively small.

2-Tier Architecture

2-tier architecture is more commonly used in small to medium-sized applications. It divides


the DBMS into two layers:

● The Client layer (front end)


● The Server layer (back end)

How It Works:

● The Client is the user's interface, like an application or software where users input
their data.
● The Server is where the actual data is stored and managed.

Example: Imagine you’re using an online banking app. Your app (the client) connects to the
bank’s server, where all your account data is stored. The server handles all your requests, like
checking your balance or transferring money.

Interesting Fact: In the 2-tier architecture, the client directly interacts with the database
server. This is why it's fast for small-scale applications but can become slow if too many
users access the server simultaneously.

3-Tier Architecture

27
Dr. Shweta

3-tier architecture is the most common and versatile architecture used in modern DBMS
systems. It adds an extra layer between the client and the server, known as the Application
layer (or middle tier).

Layers in 3-Tier Architecture:

1. Client Tier (Presentation Layer): This is the user interface, like your web browser
or mobile app, where you interact with the system.
2. Application Tier (Logic Layer): This is the brain of the operation. It processes the
business logic, performs calculations, and decides how data should be handled.
3. Database Tier (Data Layer): This is where the actual data is stored and managed. It
includes the DBMS software and the physical database.

How It Works:

● The Client sends a request to the Application layer.


● The Application layer processes the request, interacts with the Database layer,
retrieves or updates data, and sends the response back to the Client.

Example: Think of an online shopping website like Amazon. When you search for a product,
the client (your browser) sends a request to the application server. The application server
checks the database to find the products, processes the information, and sends it back to your
browser.

28
Dr. Shweta

Interesting Fact: The 3-tier architecture is very scalable, meaning it can handle many users
at once, which is why it’s used by large applications like e-commerce platforms, social media
sites, and banking systems.

Architecture Description Use Case Scalability


Type

1-Tier Direct access to DBMS Small, single-user Low


applications

2-Tier Client-server architecture Small to medium-sized Medium


applications

3-Tier Client, application, and Large, enterprise-level High


database layers applications

Fun Fact:

Did you know that the 3-tier architecture is the foundation for most web applications?
From social media platforms like Facebook to online banking, this architecture makes it
possible for millions of users to interact with the same system seamlessly.

Views of Data in DBMS


“In a Database Management System (DBMS), the concept of "views of data" is essential for
understanding how data is perceived, accessed, and managed by different users and
applications.”
Think of it as looking at a building from different angles—each angle gives you a unique
perspective, but it’s all the same building. Similarly, in DBMS, the data can be viewed in
multiple ways depending on the user’s role and requirements.

Three Levels of Data Abstraction

29
Dr. Shweta

DBMS architecture often organises data into three levels or views, which help in abstracting
the complexity of data management. These levels are:

1. Physical View (Internal Level)


2. Logical View (Conceptual Level)
3. View Level (External Level)

Physical View (Internal Level) Where/How

The Physical View is the lowest level of abstraction and deals with where the data is actually
stored in the database. This view includes details like the file structures, indexes, and other
storage mechanisms used by the DBMS to manage data.

It is the most fundamental layer of DBMS architecture. This level deals with the actual
storage of data on physical hardware like hard drives or SSDs. The Physical Level is the
backbone of the DBMS. It’s where the raw data resides, organized in a way that supports
efficient retrieval and storage. Though invisible to the end user, the decisions made at this

30
Dr. Shweta

level have far-reaching consequences on the performance, scalability, and reliability of the
database system.

Example: Imagine a library where books are stored in a specific order on shelves. The
physical view would be concerned with how the books are physically arranged on those
shelves, the type of shelving used, and how the library catalogue is stored.

Consider a large-scale e-commerce website like Amazon. The physical level would involve
the actual storage of product details, user information, transaction records, and more. This
data might be spread across multiple servers and data centres worldwide. The DBMS at the
physical level ensures that this data is stored in an organised manner, with proper indexing to
allow for quick searches and retrieval, even as the database grows to include billions of
records.

Note: In most cases, users never interact with the physical view directly. It’s managed by the
DBMS, which ensures efficient data storage and retrieval.

Importance : The physical level is critical because it directly impacts the performance and
reliability of the database. Well-designed physical storage mechanisms can drastically
reduce the time it takes to retrieve data and can handle large amounts of data without
sacrificing performance.

Logical View (Conceptual Level) What

The Logical Level, also known as the Conceptual Level, is the middle layer of DBMS
architecture. It represents the entire database as seen by the DBMS itself, abstracting away
the details of how the data is physically stored. The Logical View represents the structure of
the entire database as understood by the DBMS. It’s a middle level of abstraction that
describes what data is stored in the database and the relationships among those data. The
logical view is independent of how the data is physically stored, focusing instead on the
logical relationships.

At the logical level, the DBMS manages the database’s structure and ensures that data
remains consistent, accurate, and accessible. Key activities include Normalisation, Query
Processing, and Security.

31
Dr. Shweta

Example: Continuing with the library analogy, the logical view would be like the library’s
catalog system. It describes the books available, their authors, genres, and how they are
related to each other, but it doesn’t concern itself with how or where the books are actually
placed on the shelves.

Technical Example : Imagine a university’s database system. The logical level would define
entities like Students, Courses, and Teachers. It would also describe the relationships
between these entities (e.g., students enrol in courses, teachers teach courses) and enforce
rules like each course must have at least one teacher. The logical level doesn’t worry about
how this data is stored on disk; it only concerns itself with how the data is logically structured
and related.

Importance

The logical level is critical because it defines the data organisation within the database. It’s
where the structure of the database is determined, and it plays a vital role in ensuring that the
data remains consistent, accurate, and easy to retrieve.

3. View Level (External Level) who

The View Level is the highest/topmost level of abstraction and is concerned with the types of
individual users or user groups perceiving the data i.e who are going to see the data and
which part of the data. It provides a way to hide the complexity of the database from end
users and allows different users to have different views of the same database. The view level
is all about customization, ensuring that each user sees the data in a way that is most useful to
them.

Example: In our library example, the view level would be like a customised reading list or a
personalised section of the catalogue that only shows books relevant to a particular reader,
such as children’s books for kids or research papers for scholars.

Consider another example of a hospital management system. Different users (doctors, nurses,
administrators, patients) need different views of the database:

● Doctors might see a view that includes detailed patient records, lab results, and
treatment plans.

32
Dr. Shweta

● Nurses might see a more focused view with patient vitals, medication schedules, and
care instructions.
● Administrators might see a view with patient admission and discharge records,
billing information, and hospital resource allocation.
● Patients might only see their own medical records, appointment schedules, and
billing statements.

Each of these views is customised to meet the needs of the specific user, providing them with
the information they need while hiding unnecessary details.

Interesting Fact: The view level is particularly useful for security purposes. Different
users can be given access to different views of the data, ensuring that sensitive information
is only visible to those with the proper permissions.

Level state Description Purpose User


Interaction

Physical Where and How data is Manages storage Rarely


View How - Where physically stored in efficiency and accessed by
is the data the database. access speed. end users.
stored?
(Focuses on
the physical
location and
storage
mechanisms of
the data.) and
How this data
is stored.

33
Dr. Shweta

Logical What - What The overall Defines the logical Used by


View data is stored structure and relationships in the database
and what are organization of the database. administrators.
its data.
relationships?
(Focuses on
the structure,
relationships,
and
organization of
the data.)

View Level Who can see which Provides a Commonly


who - Data
part of the data is customized, accessed by
presented to
just like a window? user-specific view end users.
who i.e. users?
of data.
(Focuses on
who can
access, view,
and interact
with which
part of data.)

Real-Life Analogy

Consider an online shopping platform like Amazon.

● Physical View: The physical view would be the backend servers and databases where
all the product information, user data, and transactions are stored. It includes details
like how the data is distributed across servers.
● Logical View: The logical view is how the platform's data is organised—like the
categories of products, relationships between orders and users, and inventory
management.

34
Dr. Shweta

● View Level: The view level is what you see when you log in. If you're a customer,
you see products to buy. If you’re a seller, you see inventory and sales data. An admin
might see everything but in a more summarized form.

Importance of Views of Data

1. Data Abstraction: The different views allow for data abstraction, meaning users
interact with data without worrying about its complexity.
2. Security: By providing different views, sensitive information can be restricted to
authorized users only.
3. Simplified Interaction: Users can interact with data in a way that’s most relevant to
them, making the system easier to use.

Conclusion

The various views of data in a DBMS ensure that the system is flexible, secure, and easy to
use. By separating the data into physical, logical, and view levels, the DBMS can efficiently
manage and present data according to the needs of different users, without overwhelming
them with unnecessary details. This layered approach helps keep the system organized and
accessible, making it easier to work with large and complex databases.

Data Independence
Data Independence is a key concept in Database Management Systems (DBMS) that allows
for the separation of data from the application programs that use the data. This separation
means that changes in the data structure or storage do not affect the application programs or
the way users interact with the data. Essentially, it ensures that the data can be modified or
updated without having to rewrite application programs.

Data independence is achieved through the use of abstraction layers in DBMS, which we
have already discussed: the Physical Level, Logical Level, and View Level. There are two
main types of data independence:

1. Physical Data Independence


2. Logical Data Independence

35
Dr. Shweta

1. Physical Data Independence

Physical Data Independence refers to the ability to change the physical storage of data
without affecting the logical structure or the application programs.

Explanation:

● Physical Data Independence means that changes to the physical level of the database
(e.g., how data is stored on disk, how files are organized, indexing methods, storage
devices used) do not require changes at the logical level or in application programs.
● For example, if a database administrator decides to reorganize the way data is stored
to improve performance, such as by changing the indexing method or moving from
one storage device to another, these changes should not affect how the data is
logically structured or how the users and applications interact with it.

Example:

Consider a university database system. Suppose the data for student records is initially stored
on a single hard drive. Later, the university decides to migrate to a cloud storage system for
better scalability and access speed. With physical data independence, the change from hard

36
Dr. Shweta

drive storage to cloud storage should not require any modifications to the database schema
(logical level) or the application programs used by students and staff.

Importance:

● Flexibility: Physical data independence provides flexibility in data storage


management, allowing administrators to optimize and upgrade storage without
disrupting users or applications.
● Maintenance: It reduces the maintenance burden because storage changes do not
necessitate application changes.
● Performance Optimization: Physical data independence allows for performance
optimization at the storage level without affecting the database’s logical design or user
operations.

2. Logical Data Independence

Logical Data Independence refers to the ability to change the logical structure of the
database without affecting the external views or application programs.

Explanation:

● Logical Data Independence means that changes to the logical level of the database
(e.g., changing the schema, adding or deleting fields, modifying relationships) do not
require changes at the view level or in application programs.
● For example, if a database administrator needs to add a new field to a table or change
the relationship between tables, these changes should not affect how the users see the
data or how the applications interact with the data.

Example:

In the same university database, suppose the schema is modified to include a new field,
"Student_Age," in the "Students" table. With logical data independence, the applications used
by students and faculty to view and update student records do not need to be changed to
accommodate this new field. The applications will continue to function as before, without
any modification, unless the new field is specifically needed in the user interface.

37
Dr. Shweta

Importance:

● Schema Evolution: Logical data independence allows for the evolution of the
database schema as organizational needs change, without requiring a complete
overhaul of existing applications.
● User Interaction Stability: It ensures stability in user interactions with the database,
even as the underlying structure of the database evolves.
● Ease of Updating: Logical data independence makes it easier to update and maintain
the database over time, as new requirements can be integrated without disrupting
existing systems.

Comparison: Physical vs. Logical Data Independence


Aspect Physical Data Independence Logical Data Independence

Focus Concerned with the physical Concerned with the structure and
storage and retrieval mechanisms. organization of the logical database
schema.

Impact of Changes in physical storage do not Changes in the logical structure do


Changes affect the logical structure or not affect external views or
applications. applications.

Example Moving from hard drive storage to Adding a new field to a table without
cloud storage without affecting the affecting user interfaces or
schema. applications.

Importance Allows optimization and upgrades Allows flexibility in modifying the


in storage management. database schema as organizational
needs change.

Achieving Data Independence in DBMS

Data independence is achieved through the abstraction provided by the DBMS architecture:

38
Dr. Shweta

1. Three-Level Architecture: The division into physical, logical, and view levels in
DBMS ensures that changes at one level do not necessitate changes at other levels.
This modular approach allows for greater flexibility and ease of maintenance.
2. Data Models and Schemas: The use of data models (like the relational model) and
schemas (conceptual, internal, and external schemas) allows DBMS to define data at
various levels of abstraction, thus facilitating data independence.
3. Database Languages: High-level query languages like SQL are used to interact with
the logical view of the data, abstracting away the physical storage details. This also
contributes to data independence.

Conclusion

Data Independence is a fundamental principle in DBMS that ensures that changes in data
storage or structure do not disrupt the applications or users interacting with the data.

● Physical Data Independence deals with the separation of storage details from the
logical structure.
● Logical Data Independence focuses on maintaining the stability of user interactions
despite changes in the logical organization of the data.

Together, these types of data independence allow databases to be more flexible, easier to
maintain, and capable of evolving with the needs of the organization without requiring
constant rewriting of application programs.

Database Languages in DBMS


Database languages are specialized programming languages used to interact with and manage
databases. They enable users and administrators to create, modify, query, and control the data
stored within a database. Each type of database language serves a specific purpose, and
understanding these languages is crucial for anyone working with databases.

In DBMS, the primary types of database languages are:

39
Dr. Shweta

1. Data Definition Language (DDL)


2. Data Manipulation Language (DML)
3. Data Control Language (DCL)
4. Transaction Control Language (TCL)

Data Definition Language (DDL)

Data Definition Language (DDL) is used to define and manage all structures within a
database. It focuses on creating, modifying, and deleting database objects like tables, indexes,
and views.

Key Functions:

● CREATE: Used to create new database objects such as tables, views, indexes, and
schemas.
● ALTER: Used to modify existing database objects, like adding a new column to a
table or changing a data type.
● DROP: Used to delete database objects, like tables or views.
● TRUNCATE: Used to remove all records from a table quickly, without removing the
table itself.
● RENAME: Used to rename a database object.

Importance:

● Schema Definition: DDL is essential for defining the structure and organization of
data within the database.
● Database Design: It allows database administrators to design and modify the
database schema according to the needs of the application.

2. Data Manipulation Language (DML)

Data Manipulation Language (DML) is used to retrieve, insert, update, and delete data
within the database. DML commands deal directly with the data stored in tables and are
typically used by end-users to interact with the database.

Key Functions:

40
Dr. Shweta

● SELECT: Retrieves data from one or more tables based on specified conditions.
● INSERT: Adds new rows of data into a table.
● UPDATE: Modifies existing data in a table based on specified conditions.
● DELETE: Removes data from a table based on specified conditions.

Importance:

● Data Interaction: DML is critical for interacting with the data stored in the database,
enabling users to perform CRUD (Create, Read, Update, Delete) operations.
● Dynamic Data Handling: It allows for the dynamic handling of data, making it
possible to modify data as needed without altering the database structure.

3. Data Control Language (DCL)

Data Control Language (DCL) is used to control access to the data within the database. It is
primarily concerned with granting and revoking permissions to users and roles, ensuring data
security and integrity.

Key Functions:

● GRANT: Provides specific privileges to users or roles, such as the ability to select,
insert, update, or delete data.
● REVOKE: Removes previously granted privileges from users or roles.

Importance:

● Security: DCL is essential for managing access to sensitive data, ensuring that only
authorized users can perform specific actions.
● Data Integrity: By controlling who can modify data, DCL helps maintain the
integrity and accuracy of the database.

4. Transaction Control Language (TCL)

Transaction Control Language (TCL) is used to manage transactions within the database.
A transaction is a sequence of one or more SQL operations treated as a single unit of work.
TCL commands ensure that transactions are executed in a way that maintains the consistency
and integrity of the database.

41
Dr. Shweta

Key Functions:

● COMMIT: Saves all changes made during the current transaction to the database.
● ROLLBACK: Reverts all changes made during the current transaction, restoring the
database to its previous state.
● SAVEPOINT: Sets a point within a transaction to which you can later roll back.
● SET TRANSACTION: Sets the characteristics for the current transaction, such as its
isolation level.

Importance:

● Consistency: TCL ensures that all operations within a transaction are completed
successfully before they are permanently applied to the database, maintaining
consistency.
● Recovery: In case of errors or failures, TCL commands like ROLLBACK allow the
database to recover to a stable state.
● Atomicity: TCL ensures that a transaction is atomic, meaning all operations within it
are either fully completed or fully undone.

Summary

Understanding the different database languages is crucial for effectively managing and
interacting with a database:

● DDL (Data Definition Language): Defines the structure of the database, allowing
the creation and modification of database objects like tables and schemas.
● DML (Data Manipulation Language): Enables interaction with the data, allowing
users to retrieve, insert, update, and delete data.
● DCL (Data Control Language): Controls access to the data, ensuring that only
authorised users can perform certain actions.
● TCL (Transaction Control Language): Manages transactions, ensuring that the
database remains consistent and stable, even in the face of errors.

These languages work together to provide a complete toolkit for database management,
allowing for the creation, manipulation, control, and preservation of data within a DBMS.

42
Dr. Shweta

Data Models in DBMS


In Database Management Systems (DBMS), data models are essential frameworks that
define how data is structured, stored, and manipulated within a database. A data model
provides a systematic way to organise and represent data, helping to create a bridge between
the real-world environment and the database's architecture. Understanding different data
models is crucial for anyone working with databases because they define how data will be
stored, how relationships between data are managed, and how data can be retrieved and
updated.

There are several types of data models used in DBMS, each serving specific purposes. The
primary types of data models include:

1. Hierarchical Data Model


2. Network Data Model
3. Relational Data Model
4. Entity-Relationship (ER) Data Model
5. Object-Oriented Data Model

1. Hierarchical Data Model

The Hierarchical Data Model is one of the earliest and most straightforward data models
used in database management systems (DBMS). Developed in the 1960s, it was
predominantly used in IBM’s Information Management System (IMS). Despite its simplicity,
it laid the groundwork for more complex data models that followed.

The hierarchical data model organizes data in a tree-like structure, where each record has a
single parent and possibly many children. This parent-child relationship represents a
one-to-many relationship, where each child record is linked to one parent, but a parent can
have multiple children. This model is particularly effective for applications where data is
naturally hierarchical, such as organizational structures, file systems, and XML documents.

Key Characteristics

43
Dr. Shweta

1. Tree Structure:
○ The hierarchical model organizes data into a tree structure. The topmost node
of the tree is known as the root, and the nodes below it are referred to as
children. Each child node can have its children, and so on, creating a
multilevel hierarchy.
2. Parent-Child Relationship:
○ Every child node in this model has a single parent, which establishes a strict
hierarchy. This parent-child relationship is the fundamental building block of
the hierarchical data model.
3. One-to-Many Relationships:
○ The model efficiently handles one-to-many relationships, where one parent
node can have multiple child nodes, but each child node is linked to only one
parent.
4. Data Retrieval:
○ Data retrieval in the hierarchical model is relatively fast and efficient because
of its tree structure. Navigating from one node to another is straightforward,
following the parent-child relationships.
5. Sequential Access:
○ Accessing data in the hierarchical model often requires sequential
processing, meaning you must traverse the hierarchy from the root to the
desired node. This can make certain types of queries cumbersome, especially
if they don’t align well with the tree structure.

44
Dr. Shweta

Example of Hierarchical Data Model

Let’s consider a simple example of a company’s organizational structure, where the hierarchy
is defined as follows:

● Company (Root)
○ Department A (Child of Company)
■ Manager A1 (Child of Department A)
■ Manager A2 (Child of Department A)
○ Department B (Child of Company)
■ Manager B1 (Child of Department B)
■ Manager B2 (Child of Department B)
■ Employee B2.1 (Child of Manager B2)
■ Employee B2.2 (Child of Manager B2)

In this example:

● "Company" is the root node.


● "Department A" and "Department B" are child nodes of "Company."
● "Manager A1" and "Manager A2" are children of "Department A," while "Manager
B1" and "Manager B2" are children of "Department B."
● "Employee B2.1" and "Employee B2.2" are children of "Manager B2."

45
Dr. Shweta

This hierarchical structure clearly defines relationships between various entities in the
company.

Advantages of Hierarchical Data Model

1. Simplicity:
○ The model is conceptually simple and easy to design for data that naturally fits
into a hierarchical structure.
2. Data Integrity:
○ The parent-child relationship enforces data integrity by ensuring that each
child node is directly associated with a parent node.
3. Performance:
○ For certain types of queries, especially those that naturally traverse the
hierarchy (e.g., finding all employees in a department), the hierarchical model
offers high performance due to its efficient tree traversal.
4. Data Security:
○ The strict parent-child relationship can help enforce security measures, where
access control can be managed at different levels of the hierarchy.
5. Data Independence:
○ Changes in the structure at one level of the hierarchy typically do not affect
other levels, offering a degree of data independence.

Limitations of Hierarchical Data Model

1. Rigidity:
○ The hierarchical model is inflexible. Once the hierarchy is established, it is
difficult to reorganize or modify without significant changes to the database
structure.
2. Redundancy:
○ Data redundancy can occur if a data item needs to be associated with multiple
parent records. This results in duplication of data across different branches of
the hierarchy.
3. Complex Queries:

46
Dr. Shweta

○ While the model is efficient for hierarchical queries, it can be cumbersome for
complex queries that don’t align well with the tree structure. For instance,
retrieving data that spans multiple branches of the hierarchy can be difficult.
4. Limited Relationship Representation:
○ The hierarchical model is restricted to one-to-many relationships. It cannot
efficiently represent many-to-many relationships, limiting its application in
more complex scenarios.
5. Sequential Access Requirement:
○ Since data is stored in a specific hierarchical order, access to specific nodes
often requires traversing the tree sequentially from the root. This can be
inefficient for certain types of queries or updates.

Real-Life Applications

The hierarchical data model, despite its limitations, is still used in specific applications where
data naturally fits into a hierarchy. Some real-life examples include:

1. File Systems:
○ Most operating systems use a hierarchical file system, where directories are
organized in a tree structure. For instance, the root directory contains
subdirectories, which in turn contain files or further subdirectories.
2. Organizational Charts:
○ Companies often use hierarchical models to represent their organizational
structures, where each level of the hierarchy corresponds to a different level of
management.
3. XML Data Representation:
○ XML (eXtensible Markup Language) data is often structured hierarchically,
where elements can contain nested sub-elements, resembling a tree structure.
4. Biological Taxonomy:
○ The classification of living organisms follows a hierarchical structure, from
kingdom down to species.

Historical Context and Evolution

The hierarchical data model was a precursor to more sophisticated data models like the
network and relational models. It was primarily developed during the 1960s, a time when the

47
Dr. Shweta

requirements for data processing were simpler and more structured. IBM’s IMS (Information
Management System) was one of the first database management systems to implement the
hierarchical model.

As databases evolved to handle more complex and diverse types of data, the limitations of the
hierarchical model became apparent. This led to the development of the network model,
which allowed more flexible relationships, and eventually to the relational model, which
became the dominant model due to its simplicity and versatility.

The hierarchical data model is a foundational concept in DBMS, characterized by its tree-like
structure, parent-child relationships, and one-to-many associations. While it is simple and
efficient for certain types of data, it has significant limitations in terms of flexibility,
redundancy, and query complexity. Understanding the hierarchical model provides valuable
insights into the evolution of database systems and their application in specific real-world
scenarios.

Network Data Model in DBMS

The Network Data Model is an extension of the hierarchical data model, introduced to
address some of its limitations. Developed in the late 1960s, the network data model
organizes data into a more flexible graph structure, allowing for more complex relationships
between data elements. This model is particularly effective in scenarios where many-to-many
relationships are common, making it more versatile than the hierarchical model.

Overview

In the network data model, data is organized in a graph, where records are nodes, and
relationships between records are represented as edges (links). Unlike the hierarchical model,
where each record has a single parent, the network model allows each record to have multiple
parent and child records, enabling many-to-many relationships. This flexibility makes the
network model well-suited for applications requiring more complex relationships and data
structures.

Key Characteristics

1. Graph Structure:

48
Dr. Shweta

○ The network model uses a graph structure to represent data. Nodes in the
graph represent records, and edges represent relationships between these
records. This structure allows for more complex relationships compared to the
tree structure of the hierarchical model.
2. Many-to-Many Relationships:
○ One of the most significant advantages of the network model is its ability to
handle many-to-many relationships. A record can have multiple parents and
multiple children, making it possible to model more complex real-world
relationships.
3. Schema Flexibility:
○ The network model provides more flexibility in terms of schema design.
Relationships between records can be easily modified or added without
requiring a complete restructuring of the database.
4. Data Access:
○ Data can be accessed in various ways, depending on the relationships between
records. The network model supports both navigational and set-oriented data
access, allowing for efficient query processing.
5. Efficiency:
○ The model is efficient for certain types of queries, especially those that
involve traversing complex relationships between records.

Example of Network Data Model

Let’s consider a simple example of a university database, where students enroll in multiple
courses, and each course can have multiple students. This is a classic many-to-many
relationship that the network model can efficiently represent.

● Student Table:
○ StudentID (Primary Key)
○ Name
○ Major
● Course Table:
○ CourseID (Primary Key)
○ CourseName
○ Instructor

49
Dr. Shweta

● Enrollment Table (Linking Table):


○ StudentID (Foreign Key referencing Student)
○ CourseID (Foreign Key referencing Course)
○ EnrollmentDate

In this example:

● Each student can enroll in multiple courses, and each course can have multiple
students enrolled in it.
● The "Enrollment" table serves as a linking table, representing the many-to-many
relationship between "Student" and "Course."
● The relationships are not limited to a strict hierarchy, allowing for a more flexible and
accurate representation of the data.

Advantages of Network Data Model

1. Complex Relationship Representation:


○ The network model excels at representing complex relationships, such as
many-to-many associations, that are difficult or impossible to model using the
hierarchical structure.
2. Flexibility in Navigation:

50
Dr. Shweta

○ Data can be navigated in multiple ways, depending on the relationships


between records. This makes the network model more versatile and powerful
for querying complex data.
3. Efficiency for Specific Queries:
○ For queries that involve traversing complex relationships, the network model
can be more efficient than the relational model. Navigational access methods
allow for faster retrieval of related records.
4. Reduced Data Redundancy:
○ By allowing multiple relationships between records, the network model can
reduce data redundancy, as the same data does not need to be duplicated across
multiple hierarchies.
5. Support for More Complex Applications:
○ The network model is well-suited for complex applications such as
telecommunications, transportation networks, and supply chain management,
where data relationships are intricate and interdependent.

Limitations of Network Data Model

1. Complexity in Design and Maintenance:


○ The network model’s flexibility comes at the cost of complexity. Designing a
network database requires careful planning to ensure that all relationships are
correctly represented. Maintenance can also be challenging, especially as the
database grows in size and complexity.
2. Navigational Complexity:
○ Although the network model allows for flexible navigation, it can be
challenging to navigate through the network if the relationships are not
straightforward. Queries that do not align well with the network structure can
be difficult to formulate and execute.
3. Lack of Standardization:
○ Unlike the relational model, which has a standardized query language (SQL),
the network model lacks a standard query language. This can make it harder to
learn and implement, as different DBMS may use different approaches to
handling network data.
4. Potential for Data Anomalies:

51
Dr. Shweta

○ The complexity of the network model can lead to data anomalies, especially if
the relationships between records are not carefully managed. This can result in
inconsistencies or errors in the data.
5. Limited Adoption:
○ Despite its advantages, the network model is less widely adopted than the
relational model. This limits its use in general-purpose applications and
reduces the availability of tools and resources for working with network
databases.

Real-Life Applications

The network data model is particularly useful in scenarios where data relationships are
complex and involve many-to-many associations. Some real-life applications include:

1. Telecommunications Networks:
○ In telecommunications, the relationships between switches, routers, and other
network elements are complex and interconnected. The network model is ideal
for representing these relationships and managing network traffic.
2. Transportation Systems:
○ Transportation networks, such as airline routes, railway systems, and shipping
lanes, involve complex relationships between different modes of transport,
routes, and destinations. The network model can effectively manage and
optimize these relationships.
3. Supply Chain Management:
○ In supply chain management, products, suppliers, manufacturers, and
distributors are interconnected in a complex web of relationships. The network
model helps in tracking and managing these relationships, ensuring efficient
supply chain operations.
4. Social Networks:
○ Social networking platforms often use network data models to represent
relationships between users, such as friendships, followers, and connections.
These relationships are inherently many-to-many and can be efficiently
managed using a network model.
5. Genealogy Databases:

52
Dr. Shweta

○ Genealogy databases, which track family histories and relationships, often use
the network model to represent the complex relationships between ancestors
and descendants. This allows for efficient searching and analysis of familial
connections.

Historical Context and Evolution

The network data model emerged in the late 1960s as a response to the limitations of the
hierarchical model. It was first formalized by the Conference on Data Systems Languages
(CODASYL) group, which developed the CODASYL DBTG (Data Base Task Group)
model. This model provided a framework for implementing network databases, which
became popular in industries requiring complex data relationships.

Over time, the network model was gradually overshadowed by the relational model, which
offered greater simplicity, flexibility, and ease of use. However, the network model remains
relevant in certain specialized applications where its ability to handle complex relationships is
essential.

The network data model is a powerful and flexible approach to managing complex data
relationships in a DBMS. Its graph-based structure allows for many-to-many relationships,
making it suitable for applications where data is interconnected in intricate ways. While it
offers significant advantages in terms of relationship representation and query efficiency, it
also comes with challenges in terms of complexity and maintenance.

Understanding the network model provides valuable insights into how databases can be
designed to handle complex, real-world data scenarios. Despite its limitations, the network
model remains a vital tool in the arsenal of database management systems, particularly for
specialized applications requiring advanced data relationship management.

Relational Data Model in DBMS

The Relational Data Model is the most widely used and accepted data model in modern
database systems. Introduced by E.F. Codd in 1970, this model organizes data into tables (or
relations), where each table consists of rows and columns. The relational model is valued for
its simplicity, flexibility, and ease of use, which makes it suitable for a wide range of
applications, from small-scale to enterprise-level systems.

53
Dr. Shweta

Key Concepts

1. Table (Relation):
○ In the relational model, data is stored in tables. Each table, also known as a
relation, represents an entity, such as a "Student" or a "Course."
○ The table is made up of rows and columns, where each row represents a record
(tuple) and each column represents an attribute (field) of the entity.
2. Row (Tuple):
○ A row in a table represents a single record in the database. For example, in a
"Student" table, each row would represent an individual student, including
details such as their ID, name, and major.
3. Column (Attribute):
○ A column in a table represents an attribute of the entity. For example, in the
"Student" table, columns might include "StudentID," "Name," and "Major."
4. Primary Key:
○ The primary key is a unique identifier for each record in a table. It ensures that
each record can be uniquely identified. For example, "StudentID" in the
"Student" table might serve as the primary key.
5. Foreign Key:
○ A foreign key is a field in one table that uniquely identifies a row in another
table. It is used to establish a relationship between the two tables. For
example, the "CourseID" in the "Enrollment" table is a foreign key that links
to the "Course" table.
6. Relations Between Tables:
○ Tables in the relational model are connected through relationships, typically
using primary and foreign keys. These relationships allow data to be retrieved
and manipulated across multiple tables efficiently.

Example of Relational Data Model

Let's continue with the university example, where we have three main entities: Students,
Courses, and Enrollments.

Tables

● Student Table:

54
Dr. Shweta

○ Columns: StudentID (Primary Key), Name, Major


○ Example Rows:
■ (1, Alice, Computer Science)
■ (2, Bob, Mathematics)
● Course Table:
○ Columns: CourseID (Primary Key), CourseName, Instructor
○ Example Rows:
■ (101, Database Systems, Dr. Smith)
■ (102, Algorithms, Prof. Jones)
● Enrollment Table:
○ Columns: EnrollmentID (Primary Key), StudentID (Foreign Key), CourseID
(Foreign Key), EnrollmentDate
○ Example Rows:
■ (1, 1, 101, 2024-01-15)
■ (2, 2, 101, 2024-01-16)

55
Dr. Shweta

Here's a diagram of the Relational Data Model using the university example. The diagram
shows three tables: Student, Course, and Enrollment. The arrows indicate the relationships
between the tables, with primary keys (PK) and foreign keys (FK) connecting them.

This diagram illustrates how the relational model organizes data into tables and how
relationships between tables are established through keys, making it easy to manage and
query related data efficiently. ​

Entity-Relationship (ER) Data Model in DBMS

The Entity-Relationship (ER) Data Model is a conceptual framework used to describe the
structure of a database. Introduced by Peter Chen in 1976, the ER model is used primarily for
database design, allowing database architects to visualize the relationships between entities in
the system. The ER model represents data in terms of entities, attributes, and relationships,
making it easier to map out the real-world scenarios that the database will need to handle.

Key Concepts

1. Entities:
○ An entity represents a real-world object or concept, such as a "Student,"
"Course," or "Instructor." Entities are the building blocks of the ER model, and
they typically correspond to tables in the relational model.
○ Entities are depicted as rectangles in an ER diagram.
2. Attributes:
○ Attributes are the properties or characteristics of an entity. For example, a
"Student" entity might have attributes such as "StudentID," "Name," and
"Major."
○ Attributes are represented as ovals connected to their respective entities in an
ER diagram.
○ Primary Key: A special attribute that uniquely identifies each instance of an
entity. In the "Student" entity, "StudentID" would be the primary key.
3. Relationships:
○ Relationships represent the associations between entities. For example, a
"Student" enrolls in a "Course," or a "Course" is taught by an "Instructor."
○ Relationships are depicted as diamonds connecting entities in an ER diagram.

56
Dr. Shweta

○ Cardinality: The cardinality of a relationship specifies the number of


instances of one entity that can be associated with instances of another entity.
Common cardinalities include one-to-one (1:1), one-to-many (1
), and many-to-many (M
).
4. Types of Relationships:
○ One-to-One (1:1): A single entity instance in one entity is associated with a
single entity instance in another entity.
○ One-to-Many (1
): A single entity instance in one entity is associated with multiple instances in
another entity.
○ Many-to-Many (M
): Multiple instances in one entity are associated with multiple instances in
another entity. This is often implemented using a linking or junction table in
the relational model.
5. Composite and Derived Attributes:
○ Composite Attributes: Attributes that can be divided into subparts. For
example, an "Address" attribute could be divided into "Street," "City," "State,"
and "ZIP Code."
○ Derived Attributes: Attributes that can be derived from other attributes. For
example, an "Age" attribute could be derived from a "Date of Birth" attribute.

Example of ER Data Model

Let's use the same university example to create an ER model. In this example, the entities
include Students, Courses, and Instructors. The relationships include Enrollment (between
students and courses) and Teaching (between instructors and courses).

Entities and Attributes

● Student:
○ Attributes: StudentID (Primary Key), Name, Major
● Course:
○ Attributes: CourseID (Primary Key), CourseName, Credits
● Instructor:

57
Dr. Shweta

○ Attributes: InstructorID (Primary Key), Name, Department

Relationships

● Enrollment (between Student and Course):


○ Attributes: EnrollmentDate
○ Cardinality: Many-to-Many (M
) - A student can enroll in multiple courses, and a course can have multiple
students.
● Teaching (between Instructor and Course):
○ Attributes: None
○ Cardinality: One-to-Many (1
) - An instructor can teach multiple courses, but each course is taught by only
one instructor.

Diagram of ER Data Model

Diagram of the Entity-Relationship (ER) Data Model using the university example. This
diagram includes the entities Student, Course, and Instructor, and their relationships,
Enrollment and Teaching. The arrows and labels indicate the cardinality of these
relationships, such as one-to-many (1) and many-to-many (M).

58
Dr. Shweta

The ER model is effective for designing databases because it visually represents how
different entities are related, making it easier to understand and manage the structure of the
database.

Schemas and Instances


In Database Management Systems (DBMS), the terms "schemas" and "instances" are
fundamental concepts that help in understanding how data is organized and managed.

Schemas

● Definition: A schema is the blueprint or structure of a database. It defines how data is


organized and how the relationships between data are managed. It includes definitions
of tables, columns, data types, constraints, and relationships between tables.
● Components:
○ Tables: Define what data will be stored.
○ Columns: Define the attributes or properties of the data.
○ Constraints: Specify rules for the data, like primary keys, foreign keys, and
unique constraints.
● Example: Imagine a library database schema. It might include tables like Books,
Authors, and Members. Each table has columns (attributes), such as BookID, Title,
AuthorID for the Books table. The schema also defines relationships between these
tables, such as the foreign key relationship between Books and Authors.

Instances

● Definition: An instance of a database refers to the actual data stored in the database at
a particular moment. It is the snapshot of the database content at any given time.
● Components:
○ Data Records: The actual entries in the tables.
○ Current Values: The values of the columns for the current data stored in the
database.
● Example: Using the same library database, an instance would be the actual records in
the Books table, like BookID = 1, Title = 'Database Systems', AuthorID = 3. It
represents the current state of the data in the database.

59
Dr. Shweta

Comparison

● Schema vs. Instance: The schema is like a blueprint or design of a building,


specifying how rooms should be arranged and what materials should be used. The
instance is like the actual building filled with furniture and people, representing the
current state of the design in use.

Schema (Library Database) Instance (Snapshot at a Given Time)

Tables: Books, Authors Data Records: BookID = 1, Title = 'Database Systems',


AuthorID = 3

Columns in Books: BookID, Data Records: BookID = 2, Title = 'Introduction to


Title, AuthorID Algorithms', AuthorID = 1

In summary, the schema defines the structure and rules for the database, while an instance
represents the actual data that exists within that structure at a particular time.

Aspect Schema Instance

Definition The blueprint or design of the The actual data present in the
database. It defines the structure database at a specific time.
and relationships.

Purpose Provides a plan for how data Represents the current state of the
should be organized and related. data in the database.

60
Dr. Shweta

Components Tables, columns, data types, Data records (rows) in the tables.
constraints, relationships.

Example Books Table Schema: Books Table Instance:

Columns: BookID, Title, AuthorID BookID = 1, Title = 'DB Basics',


AuthorID = 3

Visualization Like a blueprint or design plan for Like the actual books, with titles
a library. and authors, in the library.

Modification Changes in schema involve Changes in instance involve


altering the structure of the adding, updating, or deleting data
database (e.g., adding a column). records.

Example of Adding a new column Adding a new record to the Books


Change PublicationYear to the Books table table, such as BookID = 3, Title =
schema. 'Data Science', AuthorID = 2.

Static/Dynamic Generally static; changes Dynamic; frequently updated with


infrequently. new data.

Summary:
● DBMS Definition: A Database Management System (DBMS) is software that helps
manage, store, and retrieve data efficiently.

61
Dr. Shweta

● Purpose of DBMS: It organizes data systematically, similar to how a librarian


organizes books in a library, making it easy to find and use.
● Why DBMS is Important: It simplifies data management, reduces redundancy, and
ensures data consistency and integrity.
● File System Overview: A file system stores data as individual files without a
structured format, making it difficult to manage large datasets.
● DBMS vs. File System: Unlike file systems, DBMS stores data in a structured way
using tables and relationships, allowing for efficient data handling and retrieval.
● Real-Life Example: A school uses DBMS to store and manage student data, making
it easy to update and retrieve information like grades and attendance.
● Data Integrity: DBMS ensures that data is accurate and consistent across the
database, preventing issues like duplication.
● Data Security: DBMS provides advanced security features, allowing administrators
to control who can access or modify data.
● Data Redundancy Control: By centralizing data storage, DBMS reduces the chances
of storing duplicate data, saving space and avoiding inconsistencies.
● Backup and Recovery: DBMS systems have built-in backup and recovery features,
ensuring that data can be restored in case of system failures.
● Different Types of Database Systems: Includes Relational, Hierarchical, Network,
and NoSQL databases, each with its specific use cases.
● Relational Databases: These use tables to store data and are the most common type
of DBMS, widely used in applications like banking systems.
● User Types: Different types of users interact with DBMS, including Database
Administrators (DBAs), Application Developers, and End Users.
● DBMS Architecture: It typically follows a multi-tier structure, separating the user
interface from the data storage and processing layers.
● Advantages of DBMS: Enhanced data accessibility, security, and integrity, along with
the ability to handle large datasets efficiently.

Questions:

● Define DBMS.
● What is data redundancy, and how does DBMS help in reducing it?
● Give a real-life example of where a DBMS is used.

62
Dr. Shweta

● What role does a Database Administrator (DBA) play in DBMS?


● What is data integrity in DBMS?
● Mention one advantage of using a DBMS over a file system.
● What is the purpose of the 'Backup and Recovery' feature in DBMS?
● Name one security feature provided by a DBMS.
● What is a relational database?
● What are Naive Users

Large Questions

1. Compare and contrast the file system with a Database Management System (DBMS)
in detail.
2. Explain the architecture of DBMS with a focus on its different layers and their
functions.
3. Describe the role of different users in a DBMS?
4. What are the advantages and disadvantages of using a DBMS? Provide examples to
support your answer.
5. Explain the concept of data independence in DBMS and differentiate between
physical and logical data independence.
6. Differentiate between file system and Database
7. Explain database schema
8. What is 3-tier architecture of DBMS
9. Explain schemas of Database

Quick Revision :

1. DBMS: A DBMS is software designed to efficiently manage, store, and retrieve


data, offering significant advantages over traditional file systems.
2. File System: A method for organizing and managing files on storage devices.
3. RDBMS: A system that organizes data into tables and uses SQL for data
management.
4. Data Integrity: Ensuring accuracy and consistency of data within a database.

63
Dr. Shweta

5. Data Independence: The ability to change a database schema without affecting


other levels.
○ Physical Data Independence: Changing storage without affecting the
logical schema.
○ Logical Data Independence: Changing the logical schema without
affecting applications.
6. Backup and Recovery: Processes to protect and restore data in case of failures.
7. Relational Model: The relational model organizes data into tables, making it easy
to query and manipulate data using SQL, the standard database query language.
8. DBMS Architecture: Understanding the multi-tier architecture of DBMS,
including the client, application, and database layers, is vital for comprehending
how data flows and is processed in modern systems.

64

You might also like