0% found this document useful (0 votes)
36 views20 pages

Unit 1

Unit 1 DTU notes DBMS

Uploaded by

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

Unit 1

Unit 1 DTU notes DBMS

Uploaded by

Sukhpal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Database Concepts

What is Database System?


A Database System is a collection of interrelated data and a set of programs to access that data
in an organized and efficient manner. It allows users to store, retrieve, and manage data in a
structured way, ensuring data consistency, integrity, and security.

What is a Database?
A Database is a structured collection of data stored in a way that it can be easily accessed,
managed, and updated.

Example:
A library system database storing information about books, borrowers, and loans.

What is DBMS?
A Database Management System (DBMS) is specialized software that enables the efficient
storage, organization, retrieval, and manipulation of data in a structured and systematic manner.
At its core, a DBMS acts as an intermediary between the user, application programs, and the
physical database where data is stored. Unlike traditional file-based storage systems, where
data is stored in separate files without much organization, a DBMS provides a centralized
platform to manage data as an integrated whole.

A typical DBMS allows users to perform operations such as inserting, updating, deleting, and
querying data using high-level languages such as SQL (Structured Query Language). It also
manages the underlying complexities of data storage, access permissions, data consistency, and
concurrency, freeing users from having to deal directly with low-level file handling and physical
storage mechanisms.

The first database management systems (DBMS) were created to handle complex data for
businesses in the 1960s. These systems included Charles Bachman's Integrated Data Store
(IDS) and IBM's Information Management System (IMS). Databases were first organized into
tree-like structures using hierarchical and network models.
Edgar F. Codd popularized the relational model in the 1970s, transforming database
management systems (DBMS) with the concept of arranging data in tables, or relations and
utilizing SQL for queries. As a result, contemporary DBMS systems like Oracle and MySQL were
established. These systems are still developing today, incorporating newer technologies like
NoSQL databases to handle unstructured data.

Database Management System

Applications of DBMS
Banking System

 Account Management: Store customer account details (account number, balance,


transactions).

 Transaction Processing: Handle deposits, withdrawals, fund transfers, and generate


statements.

 Loan Processing: Store information about loans, EMI schedules, approvals.

 Security: Maintain user authentication and authorization.

Airline Reservation System

 Flight Scheduling: Store flight details, timings, fares, and availability.

 Passenger Booking: Manage reservations, ticket generation, seat assignments.

 Cancellation & Refund Processing: Track cancellations and process refunds.

 Query Processing: Quickly retrieve flight availability for specific dates and destinations.
Library Management System

 Book Catalog Management: Store book details (title, author, ISBN, availability).

 Issue & Return Records: Track book issues and returns by members.

 Fine Calculation: Automatically compute fines for overdue books.

 Member Management: Store information of library members.

University Management System

 Student Information: Manage student records (personal info, enrollment, grades).

 Course Management: Store course information, schedules, and assignments.

 Examination Processing: Record exam results and generate transcripts.

 Fee Management: Manage fee payments and outstanding balances.

Hospital Management System

 Patient Records: Store medical history, diagnoses, and treatment records.

 Appointment Scheduling: Manage doctor appointments and availability.

 Billing System: Automatically generate bills and track payments.

 Inventory Management: Manage medical supplies and pharmacy stocks.

Online Shopping Systems

 Product Catalog: Manage product details, categories, prices, and stock.

 Customer Information: Store customer profiles, order history, and preferences.

 Order Management: Track orders from placement to delivery.

 Payment Processing: Handle online payment methods and transaction tracking.

Telecommunications

 Subscriber Data: Store details of subscribers, plans, call records, and usage.

 Billing System: Generate monthly bills based on usage.

 Service Management: Manage activation, deactivation of services.

 Complaint Tracking: Manage customer service records.

Government Applications
 Voter Registration Systems: Store voter details and voting history.

 Passport Management: Store passport applications, approvals, and issuance.

 Taxation Systems: Manage taxpayer records and process tax payments.

Problems with Traditional File-Based Systems


Before the introduction of modern DBMS, data was managed using basic file systems on hard
drives. While this approach allowed users to store, retrieve and update files as needed, it came
with numerous challenges

 Data Redundancy: Duplicate entries across files

 Inconsistency: Conflicting or outdated information

 Difficult Access: Manual file search required

 Poor Security: No control over data access

 Single-User Access: No support for collaboration

 No Backup/Recovery: Data loss was often permanent

A university file-based system storing data in separate files (e.g., Academics, Results, Hostels)
often faced these problems.

Advantages of DBMS
Some advantages of DBMS are:

 Sharing of data
 Consistency of data
 Security of data
 Data independence
 Improved data access and system performance
 Improved data backups and recovery
 Potentially increased productivity

Potential disadvantages of DBMS


 Cost of implementing them
 The amount of effort needed to transfer data into the database from the current system
 Impact on the whole organization if the database fails (even for a short period)

Components of DBMS Applications


Any DBMS based applications is made up of six key components that work together to handle
data effectively.

1. Hardware

 Physical devices like servers, disks, input-output devices (keyboard, monitor, printer).

 Stores and processes data; interfaces between real-world inputs and digital systems.

 Examples: Personal computer hard disk, RAM, network devices used for DBMS
operations.

2. Software

 Actual DBMS software like MySQL, Oracle, PostgreSQL.

 Includes the database engine, OS, network software, and application tools.

 Translates database access languages into operations.

3. Data

 Raw facts stored in structured or unstructured formats.

 Operational Data: Actual user data (e.g., name, age).


 Metadata: Data about data (e.g., storage time, size, data type).

 Core reason DBMS exists—to manage and store data efficiently.

4. Procedures

 Instructions and rules for using DBMS effectively.

 Covers setup, login/logout, data validation, backup, access control, and report
generation.

 Helps ensure consistent and secure use of the system.

5. Database Access Language

 Used to interact with the database (create, read, update, delete data).

 Examples: SQL, MyAccess, Oracle PL/SQL.

 DDL (Data Definition Language) – CREATE, ALTER, DROP

 DML (Data Manipulation Language) – INSERT, UPDATE, DELETE

6. People

 Users interacting with DBMS at different levels:

 Database Administrators (DBA) – Manage security, performance, user access.

 Developers – Build applications using the database.

 End Users – Use applications to access the database (e.g., students, employees).

Types of DBMS
There are several types of Database Management Systems (DBMS), each tailored to different
data structures, scalability requirements and application needs. The most common types are as
follows:

1. Relational Database Management System (RDBMS)

 It organizes data into tables (relations) composed of rows and columns.

 Uses primary keys to uniquely identify rows and foreign keys to establish relationships
between tables.

 Queries are written in SQL (Structured Query Language), which allows for efficient data
manipulation and retrieval.
Examples: MySQL oracle, Microsoft SQL Server and Postgre SQL.

2. NoSQL DBMS

 They are designed to handle large-scale data and provide high performance for scenarios
where relational models might be restrictive.

 They store data in various non-relational formats, such as key-value pairs, documents,
graphs or columns.

 These flexible data models enable rapid scaling and are well-suited for unstructured or
semi-structured data.

Examples: MongoDB, Cassandra, DynamoDB and Redis.

3. Object-Oriented DBMS (OODBMS)

 It integrates object-oriented programming concepts into the database environment,


allowing data to be stored as objects.

 Supports complex data types and relationships, making it ideal for applications requiring
advanced data modeling and real-world simulations.

Examples: ObjectDB, db4o.

4. Hierarchical Database

 Organizes data in a tree-like structure, where each record (node) has a single parent and
have multiple children.

 This model is similar to a file system with folders and subfolders.

 It is efficient for storing data with a clear hierarchy, such as organizational charts or file
directories.

 Navigation is fast and predictable due to the fixed structure.

 It lacks flexibility and difficult to restructure or handle complex many-to-many


relationships.

Example: IBM Information Management System (IMS).

5. Network Database

 It uses a graph-like model to allow more complex relationships between entities.

 Unlike the hierarchical model, it permits each child to have multiple parents, enabling
many-to-many relationships.
 Data is represented using records and sets, where sets define the relationships.

 It is more flexible than the hierarchical model and better suited for applications with
complex data linkages.

Example: Integrated Data Store (IDS), TurboIMAGE.

6. Cloud-Based Database

 They are hosted on cloud computing platforms like AWS, Azure or Google Cloud.

 They offer on-demand scalability, high availability, automatic backups and remote
accessibility.

 These databases can be relational (SQL) or non-relational (NoSQL) and are maintained
by cloud service providers, reducing administrative overhead.

 They support modern application requirements, including distributed access and real-
time analytics.

Example: Amazon RDS (for SQL), MongoDB Atlas (for NoSQL), Google BigQuery.

Database Languages
Database languages are specialized sets of commands and instructions used to define,
manipulate and control data within a database. Each language type plays a distinct role in
database management, ensuring efficient storage, retrieval and security of data. The primary
database languages include:

1. Data Definition Language (DDL)

DDL is the short name for Data Definition Language, which deals with database schemas and
descriptions, of how the data should reside in the database.

 CREATE: to create a database and its objects like (table, index, views, store procedure,
function and triggers)

 ALTER: alters the structure of the existing database

 DROP: delete objects from the database

 TRUNCATE: remove all records from a table, including all spaces allocated for the records
are removed

 COMMENT: add comments to the data dictionary

 RENAME: rename an object


2. Data Manipulation Language (DML)

DML focuses on manipulating the data stored in the database, enabling users to retrieve, add,
update and delete data.

 SELECT: retrieve data from a database

 INSERT: insert data into a table

 UPDATE: updates existing data within a table

 DELETE: Delete all records from a database table

 MERGE: UPSERT operation (insert or update)

 CALL: call a PL/SQL or Java subprogram

 EXPLAIN PLAN: interpretation of the data access path

 LOCK TABLE: concurrency Control

3. Data Control Language (DCL)

DCL commands manage access permissions, ensuring data security by controlling who can
perform certain actions on the database.

 GRANT: Provides specific privileges to a user (e.g., SELECT, INSERT).

 REVOKE: Removes previously granted permissions from a user.

4. Transaction Control Language (TCL)

TCL commands oversee transactional data to maintain consistency, reliability and atomicity.

 ROLLBACK: Undoes changes made during a transaction.

 COMMIT: Saves all changes made during a transaction.

 SAVEPOINT: Sets a point within a transaction to which one can later roll back.

5. Data Query Language (DQL)

DQL is a subset of DML, specifically focused on data retrieval.

 SELECT: The primary DQL command, used to query data from the database without
altering its structure or contents.

Data Abstraction in DBMS


Data Abstraction is one of the most important concepts in DBMS. Data abstraction is the
process of hiding unwanted and irrelevant details from the end user. It helps to store
information in such a way that the end user can access data which is necessary, the user will
not be able to see what data is stored or how it is stored in a database.
 Data abstraction hides unwanted details, showing users only relevant data.
 It keeps data safe by hiding how and where data is stored.
 Abstraction simplifies access while maintaining data security and efficiency
 For example, while buying clothes, users see only color, size, and brand, not
production details.
Levels of Abstraction in DBMS
There are three levels of data abstraction in DBMS that are mentioned below:
 Physical or Internal level
 Logical or Conceptual level
 View or External level

Physical or Internal Level


It is the lowest level of data abstraction which defines how data is stored in database. It defines
data structures used to store data and methods to access data in database. It is very complex to
understand and hence kept hidden from user. Database administrator decides how and where
to store the data in database. Physical level deals with actual storage details like data
organization, disk space allocation and data access methods.
Logical or Conceptual Level
It is intermediate level present next to physical level. It defines what data is present in database
and their relationships between them. It is less complex as compared to physical level.
Programmers generally work at this level and depending on data, structure of tables,
relationships and their constraints is decided at this level.
View or External Level
It is the highest level in abstraction. There are different levels of views and each view defines
only a part of whole data required to user. This level defines many views of same database for
simplification of view to user. This is the highest level and easiest to understand for user.

Data Models, Schemas, and Instances


Data model
A data model is a conceptual framework for organizing and defining the structure, operations,
and constraints of data in a database.

 It describes how data is stored, connected, accessed, and manipulated.

Types of Data Models:

1. Hierarchical Data Model

The Hierarchical Data Model is the data model that organizes data in a tree-like structure,
where each record (or node) has a single parent, but can have multiple children.

 It represents one-to-many relationships, where child records are dependent on a single


parent record.
 This structure is useful for representing data with a clear hierarchical relationship, such
as organizational structures or file systems.

2. Network Data Model


The Network Data Model is an extension of the hierarchical model that allows many-to-many
relationships.

 In this model, data is represented using records (nodes) and sets (edges or links) to
connect them.

 Each record can have multiple parents and multiple children, allowing for more complex
relationships between records.

3. Relational Data Model

The Relational Data Model organizes data in two-dimensional tables (relations), consisting of
rows (tuples) and columns (attributes). Each table represents a different entity, and
relationships between tables are maintained through the use of foreign keys.

 The relational model provides a highly flexible way to handle data and is the foundation
of modern database systems like MySQL, PostgreSQL, and Oracle.

4. Object-Oriented Data Model


The Object-Oriented Data Model is based on the principles of object-oriented programming.

 In this model, data is stored in objects, which are instances of classes, and can contain
both data (attributes) and methods (operations).

 This model allows for better representation of real-world entities by encapsulating both
the state and behavior of an entity.

5. Entity-Relationship (ER) Model

The Entity-Relationship (ER) Model is a high-level conceptual model that defines the structure
of data by describing entities (objects), attributes (properties of entities), and relationships
between entities.

 The ER model is typically represented visually using ER diagrams, which help in designing
a database by mapping out the entities and relationships in a system.

Schemas
A schema is the overall logical structure of a database that defines how the data is organized
and how relationships among data are maintained.

 It can be viewed as a blueprint or architecture of the database that defines tables, fields,
data types, and relationships.

Types of Schemas:

1.) Physical Schema:

The physical schema describes how the data is actually stored on the storage media. It includes
details about the physical storage of data, such as file structures, indexing methods, and storage
allocations.

 Determines how the logical schema is implemented on physical storage devices.

 Optimizes query performance and storage utilization.

2.) Logical Schema:

The logical schema is an abstract representation of the database’s structure, capturing the
logical relationships between data elements without concern for the physical implementation
details.

 Provides a high-level understanding of the data and its relationships.

 Ensures data consistency, integrity, and normalization.

 Serves as a blueprint for database administrators and developers.

3.) External Schema:

The external schema defines how individual users or user groups interact with the database. It
provides a customized view of the database tailored to the needs of different users or
applications.
 Ensures data security by controlling user access to specific data.

 Simplifies user interactions by presenting only the relevant data and hiding the rest.

Instances
An instance refers to the actual data stored in a database at a particular moment in time. It is
the snapshot of the database content.

Instance vs. Schema: While a schema defines the structure of the database (tables, columns,
etc.), an instance represents the actual content within that structure at any given point. The
schema remains relatively static, while instances can change frequently as data is inserted,
updated, or deleted.

Database schema defines the variable declaration along with type of definition in tables that
belongs to a particular database; the value of these variables at a moment of time is called the
instance of database.

DBMS Architecture 1-level, 2-Level, 3-Level


A DBMS architecture defines how users interact with the database to read, write, or update
information. A well-designed architecture and schema (a blueprint detailing tables, fields and
relationships) ensure data consistency, improve performance and keep data secure.

Types of DBMS Architecture

There are several types of DBMS Architecture that we use according to the usage requirements.

 1-Tier Architecture

 2-Tier Architecture

 3-Tier Architecture

1-Tier Architecture

In 1-Tier Architecture, the user works directly with the database on the same system. This
means the client, server and database are all in one application. The user can open the
application, interact with the data and perform tasks without needing a separate server or
network connection.

 A common example is Microsoft Excel. Everything from the user interface to the logic
and data storage happens on the same device. The user enters data, performs
calculations and saves files directly on their computer.

 This setup is simple and easy to use, making it ideal for personal or standalone
applications. It does not require a network or complex setup, which is why it's often
used in small-scale or individual use cases.

 This architecture is simple and works well for personal, standalone applications where
no external server or network connection is needed.

2-Tier Architecture
The 2-tier architecture is similar to a basic client-server model. The application at the client end
directly communicates with the database on the server side. APIs like ODBC and JDBC are used
for this interaction. The server side is responsible for providing query processing and transaction
management functionalities.

 On the client side, the user interfaces and application programs are run. The application
on the client side establishes a connection with the server side to communicate with the
DBMS. For Example: A Library Management System used in schools or small
organizations is a classic example of two-tier architecture.

 Client Layer (Tier 1): This is the user interface that library staff or users interact with. For
example, they might use a desktop application to search for books, issue them, or check
due dates.

 Database Layer (Tier 2): The database server stores all the library records such as book
details, user information and transaction logs.

 The client layer sends a request (like searching for a book) to the database layer which
processes it and sends back the result. This separation allows the client to focus on the
user interface, while the server handles data storage and retrieval.

3-Tier Architecture

In 3-Tier Architecture, there is another layer between the client and the server. The client does
not directly communicate with the server. Instead, it interacts with an application server which
further communicates with the database system and then the query processing and transaction
management takes place. This intermediate layer acts as a medium for the exchange of partially
processed data between the server and the client. This type of architecture is used in the case
of large web applications.
Example: E-commerce Store

 User: You visit an online store, search for a product and add it to your cart.

 Processing: The system checks if the product is in stock, calculates the total price and
applies any discounts.

 Database: The product details, your cart and order history are stored in the database for
future reference.

Database Structure
Database structure refers to how data is logically organized within a database, typically in tables
with rows and columns, to ensure efficient storage, management, and retrieval.

1. Query Processor

It interprets the requests (queries) received from end user via an application program into
instructions. It also executes the user request which is received from the DML compiler. Query
Processor contains the following components -

 DML Compiler: It processes the DML statements into low level instruction (machine
language), so that they can be executed.

 DDL Interpreter: It processes the DDL statements into a set of table containing meta
data (data about data).

 Embedded DML Pre-compiler: It processes DML statements embedded in an application


program into procedural calls.
 Query Optimizer: The Query Optimizer executes instructions generated by the DML
Compiler and improves query execution efficiency by choosing the best query plan,
considering factors such as indexing, join order, and available system resources. For
instance, if a query involves joining two large tables, the optimizer will select the best
join order to minimize query execution time.

2. Storage Manager

Storage Manager is an interface between the data stored in the database and the queries
received. It is also known as Database Control System. It maintains the consistency and integrity
of the database by applying the constraints and executing the DCL statements. It is responsible
for updating, storing, deleting, and retrieving data in the database. It contains the following
components:

 Authorization Manager: It ensures role-based access control, i.e,. checks whether the
particular person is privileged to perform the requested operation or not.

 Integrity Manager: It checks the integrity constraints when the database is modified.

 Transaction Manager: It controls concurrent access by performing the operations in a


scheduled way that it receives the transaction. Thus, it ensures that the database
remains in the consistent state before and after the execution of a transaction.

 File Manager: It manages the file space and the data structure used to represent
information in the database.

 Buffer Manager: It is responsible for cache memory and the transfer of data between
the secondary storage and main memory.

3. Disk Storage

It contains the following essential components:

 Data Files: It stores the actual data in the database.

 Data Dictionary: It contains the information about the structure of database


objects such as tables, constraints, and relationships. It is the repository of information
that governs the metadata.

 Indices: Provides faster data retrieval by allowing the DBMS to find records quickly,
improving query performance.

You might also like