DBMS Unit-1
DBMS Unit-1
DBMS
What is Database
The database is a collection of inter-related data which is used to retrieve, insert and delete the data
efficiently. It is also used to organize the data in the form of a table, schema, views, and reports, etc.
For example: The college Database organizes the data about the admin, staff, students and faculty
etc.
What is Data?
Data is a collection of a distinct small unit of information. It can be used in a variety of forms like
text, numbers, media, bytes, etc.
What is Database?
A database is an organized collection of data, so that it can be easily accessed and managed
You can organize data into tables, rows, columns, and index it to make it easier to find relevant
information.
The main purpose of the database is to operate a large amount of information by storing, retrieving,
and managing data.
There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix,
PostgreSQL, SQL Server, etc.
SQL or Structured Query Language is used to operate on the data stored in a database. SQL depends
on relational algebra and tuple relational calculus.
characteristics of a database management system
There are so many characteristics of a database management system, which are as follows −
File System :
The file system is basically a way of arranging the files in a storage medium like a hard disk.
The user has to write procedures for The user not required to write
Meaning managing databases procedures.
There are a number of users who can access or retrieve the data on demand using the
application and the interfaces provided by the Database Management System (DBMS).
Types of Users
The users of the database can be classified into the following groups −
1.Native users or End Users− The native users need not be aware of the presence of the
database system. They are end users of the database who works through a menu driven
application programs.
2.Online users − Online users may communicate with databases directly through an online
terminal or indirectly through user interface and application programs.
3.Sophisticated Users − They are those users who interact with the system without writing
the program instead they form their request in database query language. They are the SQL
programmers, who are going to deal directly with the database. They write queries to delete
or select or insert and update the database.
4.Specialized Users − Specialized users who write specialized database applications that do
not fit into the fractional database processing framework.
5.Application Programmer − The application programmer users who are responsible for
developing the application programs or user interface. The application programs could be
written in high level language. For example − Java, .net, php etc,
Classification of Users
● End Users.
● Application Programmers.
● Database Administrator
The classification of users in DBMS is pictorially represented below −
The file based data management systems contained multiple files that were stored in many different
locations in a system or even across multiple systems. Because of this, there were sometimes multiple
copies of the same file which lead to data redundancy.
This is prevented in a database as there is a single database and any change in it is reflected
immediately. Because of this, there is no chance of encountering duplicate data.
Sharing of Data
In a database, the users of the database can share the data among themselves. There are various levels
of authorisation to access the data, and consequently the data can only be shared based on the correct
authorisation protocols being followed.
Data Integrity
Data integrity means that the data is accurate and consistent in the database. Data Integrity is very
important as there are multiple databases in a DBMS. All of these databases contain data that is
visible to multiple users. So it is necessary to ensure that the data is correct and consistent in all the
databases and for all the users.
Data Security
Data Security is vital concept in a database. Only authorised users should be allowed to access the
database and their identity should be authenticated using a username and password. Unauthorised
users should not be allowed to access the database under any circumstances as it violates the integrity
constraints.
Privacy
The privacy rule in a database means only the authorized users can access a database according to its
privacy constraints. There are levels of database access and a user can only view the data he is
allowed to. For example - In social networking sites, access constraints are different for different
accounts a user may want to access.
Database Management System automatically takes care of backup and recovery. The users don't need
to backup data periodically because this is taken care of by the DBMS. Moreover, it also restores the
database after a crash or system failure to its previous condition.
Data Consistency
Data consistency is ensured in a database because there is no data redundancy. All data appears
consistently across the database and the data is same for all the users viewing the database. Moreover,
any changes made to the database are immediately reflected to all the users and there is no data
inconsistency.
Data Models
Data Model is the modeling of the data description, data semantics, and consistency constraints of the
data.
Relational Data Model: This type of model designs the data in the form of rows and columns within
a table. Thus, a relational model uses tables for representing data and in-between relationships. Tables
are also called relations. The relational data model is the widely used model which is primarily used
by commercial data processing applications.
Entity-Relationship Data Model: An ER model is the logical representation of data as objects and
relationships among them. These objects are known as entities, and relationship is an association
among these entities. A set of attributes describe the entities. For example, student_name, student_id
describes the 'student' entity. A set of the same type of entities is known as an 'Entity set', and the set
of the same type of relationships is known as 'relationship set'.
Object-based Data Model: An extension of the ER model with notions of functions, encapsulation,
and object identity, as well. This model supports a rich type system that includes structured and
collection types.
Semi structured Data Model: This type of data model is different from the other three data models
(explained above). The semi structured data model allows the data specifications at places where the
individual data items of the same type may have different attributes sets.
Instance
The data which is stored in the database at a particular moment of time is called an instance
of the database.
Schema
The overall design of a database is called schema. A database schema is the skeleton structure
of the database. It represents the logical view of the entire database.
A schema contains schema objects like table, foreign key, primary key, views, columns, data
types, stored procedure, etc. A database schema can be represented by using the visual
diagram. That diagram shows the database objects and relationship with each other
(Example: https://afteracademy.com/blog/what-is-a-schema/ )
Data Independence ( Levels of Abstraction )
Logical data independence refers to change the conceptual schema without having to change
the external schema.
Logical data independence is used to separate the external level from the conceptual view.
If we do any changes in the conceptual view of the data, then the user view of the data would
not be affected.
Logical data independence occurs at the user interface level.
Physical data independence can be defined as the capacity to change the internal schema
without having to change the conceptual schema.
If we do any changes in the storage size of the database system server, then the Conceptual
structure of the database will not be affected.
Physical data independence is used to separate conceptual levels from the internal levels.
Physical data independence occurs at the logical interface level.
(Example: https://www.guru99.com/dbms-data-independence.html/ )
Query Processing
The DBMS accepts SQL commands generated from a variety of user interfaces. The query processor
of the DBMS receives the client issued queries that are written in structured query language as input
and execute them and return the results to the client. It has different sub modules like query parser,
operator evaluator, query optimizer and plan executer
After successfully checking syntax and validations, the query is converted to internal form. The
query optimizer optimizes the queries. This includes calculation of query cost.
• Optimizer: optimizes the query to improve the process of retrieving the resultant data.
(The parsed query is passed to the query optimizer, which first eliminates impossible and redundant
parts of the query, and then attempts to find the most efficient way to execute it based on internal
statistics. Since the same query can be satisfied using different execution plans that can vary in
efficiency, the optimizer picks the best available plan.)
Storage Manager
File and Access methods layer includes a variety of software for supporting the concept of a File
which, in a DBMS, is a collection of pages or a collection of records.
Indexes are used to access the data minimizing the access time. Different index techniques like
hashing, B+ tree indexing are used in DBMS.
DBMS buffer management generally uses a buffer pool that is collection of frames on the disk
The disk space manager deals with management of space on disk where the data is stored
The main aim of the transaction management module is to maintain ACID properties of
transactions.
A schedule is said to be serializable if the effect of the schedule is equivalent to a serial schedule. The
famous locking protocol used is two phase locking protocol in which locks are obtained in one phase
and released in another phase
Another task of transaction manager is recovery. During system failures, the transactions are
recovered using frequent backups and recovery.
The main aim of the recovery algorithms is to maintain consistency of the database even after system
failures. The data is stored in datafiles on the hard disk.
Data Storage:
Example: https://www.chegg.com/homework-help/database-management-systems-3rd-edition-
chapter-1-problem-8e-solution-9780072465631/
Client – The client can be any computer that requests something from the server.
Server – On the other hand, the Server is the computer that is designed to serve the requests to the
client
1 Tier Architecture in DBMS is the simplest architecture of Database in which the client, server,
and Database all reside on the same machine. A simple one tier architecture example would be
anytime you install a Database in your system and access it to practice SQL queries. But such
architecture is rarely used in production.
2-Tier Architecture
The 2-Tier architecture is same as basic client-server. In the two-tier architecture, applications on the
client end can directly communicate with the database at the server side. For this interaction, API's
like: ODBC, JDBC are used.
The user interfaces and application programs are run on the client-side.
The server side is responsible to provide the functionalities like: query processing and transaction
management.
To communicate with the DBMS, client-side application establishes a connection with the server
side..
2-Tier Architecture
3-Tier Architecture
The 3-Tier architecture contains another layer between the client and server. In this architecture, client
can't directly communicate with the server.
The application on the client-end interacts with an application server which further communicates
with the database system.
End user has no idea about the existence of the database beyond the application server. The database
also has no idea about any other user beyond the application.
Example: https://prepinsta.com/dbms/3-tier-architecture