Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Unit-I

Introduction: Database system, Characteristics (Database Vs File System), Database Users


(Actors on Scene, Workers behind the scene), Advantages of Database systems, Database
applications. Brief introduction of different Data Models; Concepts of Schema, Instance and
data independence; Three tier schema architecture for data independence; Database system
structure, environment, Centralized and Client Server architecture for the database.

DBMS

Database management system is software that is used to manage the database.

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 −

● A database management system is able to store any kind of data in a database.


● The database management system has to support ACID (atomicity, consistency,
isolation, durability) properties.
● The Database management system allows so many users to access databases at
the same time.
● Backup and recovery are the two main methods which allow users to protect the
data from damage or loss.
● It also provides multiple views for different users in a single organization.
● It follows the concept of normalization which is helpful to minimize the
redundancy of a relation.
● It also provides users query language, helpful to insert, retrieve, update, and
delete the data in a database

The characteristics of DBMS are explained below in pictorial form −

Difference between File System and DBMS

File System :

The file system is basically a way of arranging the files in a storage medium like a hard disk.

DBMS(Database Management System) :


Database Management System is basically software that manages the collection of related data. It is
used for storing data and retrieving the data effectively when it is needed.

Difference between File System and DBMS:

Basis File System DBMS

The file system is software that


manages and organizes the files in a DBMS is software for
Structure storage medium within a computer. managing the database.

Data Redundant data can be present in a file In DBMS there is no


Redundancy system. redundant data.

It provides backup and


Backup and It doesn’t provide backup and recovery recovery of data even if it is
Recovery of data if it is lost. lost.

Query There is no efficient query processing Efficient query processing is


processing in the file system. there in DBMS.

There is more data consistency


There is less data consistency in the file because of the process of
Consistency system. normalization.

It has more complexity in


It is less complex as compared to handling as compared to the
Complexity DBMS. file system.

DBMS has more security


Security File systems provide less security in mechanisms as compared to
Constraints comparison to DBMS. file systems.
Basis File System DBMS

It has a comparatively higher


Cost It is less expensive than DBMS. cost than a file system.

Data In DBMS data independence


Independence There is no data independence. exists.

Multiple users can access data


User Access Only one user can access data at a time. at a time.

The user has to write procedures for The user not required to write
Meaning managing databases procedures.

Data is distributed in many files. So, Due to centralized nature


Sharing not easy to share data sharing is easy

Different types of Database Users

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,

6.Database Administrator (DBA) - Database Administrator (DBA) is a person/team who


defines the schema and also controls the 3 levels of database. The DBA will then create a new
account id and password for the user if he/she need to access the database.

Classification of Users

DBMS mainly classified into three users −

● End Users.
● Application Programmers.
● Database Administrator
The classification of users in DBMS is pictorially represented below −

Advantages of Database Management System

Reducing Data Redundancy

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.

Backup and Recovery

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.

Schema and Instance

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

A database schema is designed by the database designers to help programmers whose


software will interact with the database. The process of database creation is called data
modeling.
Example: Let us suppose we have three tables Employee, Department and Project. So, we
can represent the schema of these three tables using the schema diagram as follows. In this
schema diagram, Employee and Department are related and the Employee and Project table
are related.

(Example: https://afteracademy.com/blog/what-is-a-schema/ )
Data Independence ( Levels of Abstraction )

Data independence can be explained using the three-schema architecture.


Data independence refers to modify the schema at one level of the database system without
altering the schema at the next higher level.
There are two types of data independence:

1. Logical Data Independence

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.

2. Physical Data Independence

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/ )

Structure of Database Management System

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.

Query Evaluation engine consists of the following components


• Parser: to parse the SQL commands received.

• Operator evaluator: to understand the operators used in the query

• Plan executor: designs a plan to obtain the result.

• 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.

The expansion of ACID is atomicity, consistency, isolation and durability.

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:

Index files are used to quickly access the data.


Catalog is a table of tables i.e. it contains metadata. The metadata is data about data like details of
tables, indexes, schema and users.

Example: https://www.chegg.com/homework-help/database-management-systems-3rd-edition-
chapter-1-problem-8e-solution-9780072465631/

Database Architecture in DBMS(Client -Server)

A Database Architecture is a representation of DBMS design. It helps to design, develop, implement,


and maintain the database management system. It also helps to understand the components of a
database.

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

Types of DBMS Architecture


There are mainly three types of DBMS architecture:
1 One Tier Architecture (Single Tier Architecture)
2 Two Tier Architecture
3 Three Tier Architecture

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.

The 3-Tier architecture is used in case of large web application.


3-Tier Architecture

Example: https://prepinsta.com/dbms/3-tier-architecture

You might also like