Dbms Tutorial
Dbms Tutorial
This tutorial explains the basics of DBMS such as its architecture, data models,
data schemas, data independence, E-R model, relation model, relational database
design, and storage and file structure. In addition, it covers a few advanced topics
such as indexing and hashing, transaction and concurrency, and backup and
recovery.
Audience
This tutorial will especially help computer science graduates in understanding the
basic-to-advanced concepts related to Database Management Systems.
Prerequisites
Before you start proceeding with this tutorial, it is recommended that you have a
good understanding of basic computer concepts such as primary memory,
secondary memory, and data structures and algorithms.
All the content and graphics published in this e-book are the property of Tutorials
Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy,
distribute or republish any contents or a part of contents of this e-book in any
manner without written consent of the publisher.
We strive to update the contents of our website and tutorials as timely and as
precisely as possible, however, the contents may contain inaccuracies or errors.
Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy,
timeliness or completeness of our website or its contents including this tutorial. If
you discover any errors on our website or in this tutorial, please notify us at
[email protected]
i
DBMS
Table of Contents
About the Tutorial ..................................................................................................................................... i
Audience .................................................................................................................................................... i
Prerequisites .............................................................................................................................................. i
1. OVERVIEW ............................................................................................................................ 1
Characteristics .......................................................................................................................................... 1
Users ......................................................................................................................................................... 2
2. ARCHITECTURE ..................................................................................................................... 4
Database Schema...................................................................................................................................... 9
Database Instance................................................................................................................................... 10
Entity ...................................................................................................................................................... 13
Attributes ............................................................................................................................................... 13
ii
DBMS
Relationship ............................................................................................................................................ 14
Entity ...................................................................................................................................................... 17
Attributes ............................................................................................................................................... 17
Relationship ............................................................................................................................................ 19
Generalization ........................................................................................................................................ 22
Specialization .......................................................................................................................................... 22
Inheritance ............................................................................................................................................. 23
9. CODD’S 12 RULES................................................................................................................ 25
Concepts ................................................................................................................................................. 27
Constraints.............................................................................................................................................. 27
iii
DBMS
Normalization ......................................................................................................................................... 42
15. JOINS................................................................................................................................... 46
Equijoin ................................................................................................................................................... 47
iv
DBMS
RAID ........................................................................................................................................................ 53
File Operations........................................................................................................................................ 57
B+ Tree .................................................................................................................................................... 61
Hash Organization................................................................................................................................... 63
Organization ........................................................................................................................................... 66
Operation ............................................................................................................................................... 66
ACID Properties....................................................................................................................................... 68
Serializability .......................................................................................................................................... 69
Deadlock Avoidance................................................................................................................................ 77
vi
DBMS
1. OVERVIEW
Database is a collection of related data and data is a collection of facts and figures
that can be processed to produce information.
Mostly data represents recordable facts. Data aids in producing information, which is
based on facts. For example, if we have data about marks obtained by all students,
we can then conclude about toppers and average marks.
A database management system stores data in such a way that it becomes easier
to retrieve, manipulate, and produce information.
Characteristics
Traditionally, data was organized in file formats. DBMS was a new concept then, and
all the research was done to make it overcome the deficiencies in traditional style of
data management. A modern DBMS has the following characteristics:
Multiple views: DBMS offers multiple views for different users. A user who is
in the Sales department will have a different view of database than a person
working in the Production department. This feature enables the users to have
a concentrate view of the database according to their requirements.
Security: Features like multiple views offer security to some extent where
users are unable to access data of other users and departments. DBMS offers
methods to impose constraints while entering data into the database and
retrieving the same at a later stage. DBMS offers many different levels of
security features, which enables multiple users to have different views with
different features. For example, a user in the Sales department cannot see the
data that belongs to the Purchase department. Additionally, it can also be
managed how much data of the Sales department should be displayed to the
user. Since a DBMS is not saved on the disk as traditional file systems, it is
very hard for miscreants to break the code.
Users
A typical DBMS has users with different rights and permissions who use it for different
purposes. Some users retrieve data and some back it up. The users of a DBMS can
be broadly categorized as follows:
8
DBMS
Designers: Designers are the group of people who actually work on the
designing part of the database. They keep a close watch on what data should
be kept and in what format. They identify and design the whole set of entities,
relations, constraints, and views.
End Users: End users are those who actually reap the benefits of having a
DBMS. End users can range from simple viewers who pay attention to the logs
or market rates to sophisticated users such as business analysts.
9
DBMS
2. ARCHITECTURE
In 1-tier architecture, the DBMS is the only entity where the user directly sits on the
DBMS and uses it. Any changes done here will directly be done on the DBMS itself.
It does not provide handy tools for end-users. Database designers and programmers
normally prefer to use single-tier architecture.
If the architecture of DBMS is 2-tier, then it must have an application through which
the DBMS can be accessed. Programmers use 2-tier architecture where they access
the DBMS by means of an application. Here the application tier is entirely independent
of the database in terms of operation, design, and programming.
3-tier Architecture
A 3-tier architecture separates its tiers from each other based on the complexity of
the users and how they use the data present in the database. It is the most widely
used architecture to design a DBMS.
10
DBMS
Database (Data) Tier: At this tier, the database resides along with its query
processing languages. We also have the relations that define the data and their
constraints at this level.
11
DBMS
12