0% found this document useful (0 votes)
44 views15 pages

DBMS Unit I

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

DBMS Unit I

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

Database Management Systems UNIT-I

Data: data is collection of raw facts.

Information: Information is processed data.

What is database?

It is a collection of inter-related data and relationships among those data.

1.0 What is database management system?

A database-management system (DBMS) is a collection of inter-related data and a set


of programs to access those data.

(or)
A Database Management System (DBMS) is software designed to store, retrieve,
define, and manage data in a database.

Popular DBMS Software: Here, is the list of some popular DBMS systems:
• Oracle

• NCR Teradata
• Microsoft SQL Server

• MySQL
• IBM DB2

• Microsoft Access
• SQLite

• MariaDB, etc.

1.1 Disadvantages of File System


Generally, we store our data in a text file. Now think about if you want to develop a

system software for banking system, then we need to create a lot of text file to store
different information. By considering this example we understand disadvantages of

conventional based file system.

Disadvantages of File System compare to DBMS


1) Data Redundancy

__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 1
Database Management Systems UNIT-I
• Data redundancy means repetition of data.

• There is possibility of data duplication of same information in different files. This


situation leads towards data redundancy.

• As a result of data redundancy leads to memory wastage.


• Example: A customer having both kind of accounts- saving and current. In such

a situation a customer’s detail like: name, address, e-mail, contact number, city,
etc... stored in both the files, saving.txt - a file which store's details of saving

account holder and current.txt- a file which store's details of current account
holder. because of storing same information of customer in two separate files,

it leads to Data Redundancy.


2) Data Inconsistency

• Because of data redundancy, may be data is not in a consistent state.


• Example: (Here we continue above example) Suppose a customer having both

kind of accounts a saving and a current. so, in file system this customers address
is stored in both the files saving.txt and current.txt. Now customer changed

his/her address. There might be a possibility that address is changed in only


one file (saving.txt) and other (current.txt) remain unchanged. So now for the

same customer in two different file two different value/information is available


for the same field/attribute address. This is called Data Inconsistency.

3) Difficulty in Accessing Data


• In file processing system Accessing Data is not convenient and efficient.

• Example: We have stored customers data like: name, address, e-mail, contact
number, and city. Now we want a complete record of the customer who lives in

a particular city (for example, Guntur), to achieve this we need to write a


separate program OR we need to execute to separate program i) to select all

the record from file ii) select only those record whose city is Guntur from the
result of first (i) program. We cannot achieve convenient and efficient data

accessing by using both ways.


4) Limited Data Sharing/ Data Isolation
• Data are stored in various files.
__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 2
Database Management Systems UNIT-I
• File formats may be different (for example: .txt and .xml) and these files may

be stored in different folders of computer system or may be in a different


system.

• Because of isolation of data, it is difficult to share data between various


applications.

5) Integrity Problems
• It means the data available in the database is must be correct and consistent.

• To achieve this data stored in a file must satisfy the rules define by the DBA.
• Example: Initially while developing s/w for any bank they have decided that

account balance should not be less than zero, and they developed an
application program according to this constraint/rule. Now after few years

chairperson and committee member of bank have decided that minimum


balance should not be less than 2000, to implement these constraints you need

to change in application program and need to install in all systems using that
application program, but this is not an easy task.

6) Atomicity Problems
• It means, transaction/operation completes either all (100%) or none (0%).

• In other words all (any) operations on database must be atomic.


• Example: Suppose there are two bank accounts: A/c-1 and A/c-2 having

balance Rs.4500 and Rs.2000 respectively. Now we have to transfer Rs.500 from
A/c1 to A/c-2. To achieve this, entire transaction divide into two separate parts:

i) debit Rs.500 from A/c-1 and ii) credit Rs.500 to A/c-2, but after performing
debit operation somehow system goes down or power failure happened and

credit operation not complete, because of that we loss Rs.500. This leads
database towards in-consistence state.

• It is difficult to ensure atomicity in a file system, while in DBMS you do not need
to worry about it.

7) Concurrent Access Anomalies


• In any system, for better performance and faster response, multiple users are
allowed to access data concurrently.
__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 3
Database Management Systems UNIT-I
• Assume that A/c-1 having balance Rs.5000, now consider concurrent access of

A/c-1. A person access A/c-1 and debit Rs.1000 by reading A/c-1 data from
database, but before writing change back to database, simultaneously someone

performed debit operation on same account worth Rs.500. So, it will read
Rs.5000 as balance and after debit Rs.500 remaining balance is Rs. 4500. But

after two simultaneous transaction worth Rs.1000 and Rs.500 actual balance
would be Rs.3500.

• In file system, concurrent data access should be perform under some


supervision, which is usually a some program.

• Due to lack of coordination between different application program, it is difficult


to achieve this in file system.

8) Security Problems
• Database should be accessible in a limited way to different users.

• Each user are allowed to access only those data, which is required for his/her
application.

• In file processing system, different programmers are add their application


program, it is difficult to achieve security constraints.

• Example: Only a customer can check his/her account detail, no one else have to
rights to access his/her account.

1.2 Advantage of using DBMS over the traditional file system


• Fast Data Access: The data response time increases in DBMS. Example: If we

search for any train in IRCTC then we get results about that train only in a
fraction of seconds. But the file system would have given us the entire file. Such

a file size is large hence its access time will also be more.
• Minimized Data Redundancy: DBMS has different constraints like primary key

constraints which helps in ensuring that we store only unique data in our
database i.e. same data can't be stored in more than one places.

__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 4
Database Management Systems UNIT-I
• Data Consistency: Since DBMS solves the problem of data redundancy, the

problem of data consistency is automatically solved. All you need to do is just


change the data at one place and you are good to go.

• Security: We have role-based access control in DBMS. Each user has a different
set of access thus the data is secured from problems like data leaks, misuse of

data etc. Example: In a university system the access is restricted according to


the user. The teachers, students, accounts manager etc. all have different access

i.e. the accounts manager will have the access to all the data related to the
accounts and the teacher will not be allowed to view the accounts data.

• No attributes for accessing the data: Here, we don't need to know the
location of the file. The user makes a request from any web application or app

and the server responds accordingly. Example: If we want to know the fastest
train between two stations we make a request on IRCTC and we get the result

and we don't need to know where the data is stored.


• Concurrent Access: Multiple users can access the database at the same time

when we are using the Database Management System.

Characteristics of Database Management System

• Provides security and removes redundancy


• Self-describing nature of a database system

• Insulation between programs and data abstraction


• Support of multiple views of the data

• Sharing of data and multiuser transaction processing


• DBMS allows entities and relations among them to form tables.

• It follows the ACID concept (Atomicity, Consistency, Isolation, and Durability).


• DBMS supports multi-user environment that allows users to access and

manipulate data in parallel.

1.3 Applications of DBMS


• Banking: all transactions.

__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 5
Database Management Systems UNIT-I
• Airlines: reservations, schedules.

• Universities: registration, grades.


• Sales: customers, products, purchases.

• Manufacturing: production, inventory, orders, supply chain.


• Human Resources: employee records, salaries, tax deductions.

1.4 View of Data / Data Abstraction

Data Abstraction refers to the process of hiding irrelevant details from the user. There
are mainly three levels of data abstraction. They are:

1. Physical Level
2. Conceptual Level

3. View Level

Physical Level:

• Describes HOW data are actually stored.


• It deals with the data structures used in physical level.

• It is also called as Internal level.


Logical Level:

• Describes WHAT data is stored in database and their relationships among


data.
• This level is usually designed by using ER diagrams.
__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 6
Database Management Systems UNIT-I
• It is otherwise called as Conceptual Level, Schema level.

External Level:
• Only part of the database can be viewed at a time but not the entire database.

• Database has many views.


• It is otherwise called as Subschema level, View level.

1.5 Data Independence

Data independence refers to the property of DBMS through which we can modify
the schema definition at one level without changing the schema definition at higher

level.
We have two levels of data independence that are defined on the basis of three

levels of abstraction.
1. Physical Data Independence

2. Logical Data Independence

Physical Data Independence

Physical Data Independence refers to the characteristic of changing the physical level
without affecting the logical level or conceptual level. Using this property, we can easily

change the storage device of the database without affecting the logical schema.

Example: Suppose you want to replace the storage device form hard disk to SSD or
magnetic tape then it should not affect the data stored at the logical level.

Logical Data Independence


It refers to the characteristics of changing the logical level without affecting the

external or view level. If we do any changes in the logical level then the user view of
the data remains unaffected. The changes in the logical level are required whenever

there is a change in the logical structure of the database.

The changes in the logical level may include:


• Changing the data definition.
__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 7
Database Management Systems UNIT-I
• Adding, deleting, or updating any new attribute, entity or relationship in the

database.

Instances and Schemas in DBMS

Schema: The overall description of a database is called as schema


Instance: The collection of data stored in database at a particular moment or time is

called Instance.

1.6 Data Models

• Data model is a collection of conceptual tools for describing data, data


relationships, data semantics and consistency constraints.

• Data Models are used to show how data is stored, connected, accessed and
updated in the database management system

• There are many data models being used nowadays but the relational model is
the most widely used model.

• Data models are classified into two categories. They are:


o Object-based logical models.

o Record-based logical models.

Object Based Logical Models

• There is no fixed format for representing data.


• These models consist of conceptual tools.

• These are used for designing the logical/ conceptual level of a database.
• Otherwise called as semantic models.

• For example: ER Model, ER diagrams are used for designing logical level of a
database.

Record Based Logical Models:


• There is fixed format for representing data

• Data Models in this category are:


o Network Model
o Hierarchical Model
__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 8
Database Management Systems UNIT-I
o Relational Model

• Network Model uses the data structure Graph for representing data
• Hierarchical Model uses the data structure Tree for representing the data

• Relational Model uses relation / table (set of rows & columns) for representing
data

Hierarchical Model
Hierarchical Model was the first DBMS model. This model organizes the data in the

hierarchical tree structure. The hierarchy starts from the root which has root data and
then it expands in the form of a tree adding child node to the parent node. This model

easily represents some of the real-world relationships like food recipes, sitemap of a
website etc.

Example: We can represent the relationship between the shoes present on a shopping
website in the following way:

Network Model

This model is an extension of the hierarchical model. It was the most popular model
before the relational model. This model is the same as the hierarchical model, the only

difference is that a record can have more than one parent. It replaces the hierarchical
tree with a graph.

__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 9
Database Management Systems UNIT-I
Example: we can see that node student has two parents i.e., CSE Department and

Library. This was earlier not possible in the hierarchical model.

• Both network and hierarchical models are involved with a greater number of

pointers.
• A single misplaced pointer corrupts the entire database.

Relational Model
Relational Model is the most widely used model. In this model, the data is maintained

in the form of a two-dimensional table. All the information is stored in the form of row
and columns. The basic structure of a relational model is table. So, the tables are also

called relations in the relational model.


For example: We have an Employee table.

• A tuple/ row is a combination of different column values of one real world

object.
• Number of columns represents degree of the table.
__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 10
Database Management Systems UNIT-I
• Number of tuples represents cardinality of the table.

• Set of possible values for a column is domain.


• Tuple is identified uniquely by using primary key.

Properties of Relation:
• All values in a table are atomic.

• Rows are unordered from top to bottom.


• Columns are unordered from left to right.

• Relation must contain primary key for identifying rows uniquely.

Advantages of Relational Model

• Simple: This model is simpler as compared to the network and hierarchical


model.

• Scalable: This model can be easily scaled as we can add as many rows and
columns we want.

• Structural Independence: We can make changes in database structure without


changing the way to access the data.

1.7 Database Users:


• Any person who uses the database and takes benefits from the database is

considered as Database User.


• They can be programmers, scientists, engineers, business person or can be an

employee.
• They are:

1. Database Administrators.
2. Database Designers.

3. System Analysts.
4. Application Programmers.

5. Sophisticated Users.
6. Naïve Users/Parametric Users.
7. Casual/Temporary Users.
__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 11
Database Management Systems UNIT-I
DBA stands for database administrator
He is responsible for managing the overall database management system like a
superuser of the system.
DBA is responsible for:

• Schema Definition: The DBA creates the original database schema by


executing a set of data definition statements in the DDL.

• Storage Structure and Access Method Definition: The storage structure and
accessing methods of data at physical storage medium is modified by DBA only.

• Schema and Physical Organization Modification: The DBA carries out


changes to the schema and physical organization in-order to meet the

requirement of organization when needed and to increase the performance of


system.

• Granting of Authorization for Data Access: DBA regulates the access of


various parts of database. Users can access only limited parts of database. A

user must take authorization from DBA in-order to access the parts which the
user cannot access.

• Routine Maintenance: The routine activities of DBA are:


o Periodical backups of database.

o Upgrading disk space in-order to provide space for normal operations.


o Monitoring tasks running on the database and ensuring the performance

of database without degrading.


• New Software Installation.

• Monitoring the database Server’s health and Tuning accordingly.


Database Designers

• Database designers design the appropriate structure for the database, where
we share data.

System Analyst
• System analyst analyses the requirements of end-users, especially naïve and

parametric end users.


• They are responsible for the design, structure, and properties of the database.
Application Programmers
__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 12
Database Management Systems UNIT-I
• Application programmers are computer professionals, who write application

programs.
• They develop application programs such as C, C++, Java, PHP, Python, etc.

through which another user can interact with the database.


Sophisticated Users

• Sophisticated users can be engineers, scientists, business analysts, who are


familiar with the database.

• These users interact with the database but they do not write programs
Naïve Users / Parametric Users

• Naïve Users are Unsophisticated users, who have no knowledge of the database.
• They are the end-users of the database who work through the menu-driven

applications.
• For Example: Railway’s ticket booking users are naive users. Or Clerical staff in

any bank is a naïve user.


Casual Users / Temporary Users

• These types of users communicate with the database for a little period of time.

1.8 Structure of DBMS

The database system is divided into three components: Query Processor, Storage
Manager, and Disk Storage.

1. Storage Manager:

• It is a program module which provides interface between the low-level data


stored in the database and the application programs and queries submitted to

the system.
• It is responsible for interaction with the File Manager.

• It translates DML commands into low level file system commands.


• It is responsible for storing, retrieving and updating data in database.

• It includes the following components:


a) Authorization and Integrity Manager: Tests the integrity constraints and
authorization of users.

__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 13
Database Management Systems UNIT-I
b) Transaction Manager: Ensures the consistency of database despite of system

failures by non-conflicting schemes.


c) File Manager: Manages the allocation of space on disk storage and data

structures used to represent data on disk.


d) Buffer Manager: It is responsible for fetching data from disk storage to main
memory.

2. Disk Storage

The Storage Manager implements several data structures at physical level of database.
They are:

__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 14
Database Management Systems UNIT-I
• Data Files: Stores database.

• Data Dictionary: Store metadata of stored database.


• Indices: Provides fast access to database. Hashing is alternative to indexing.

3. Query Processor

The Query Processor contains the following components:


• DDL Interpreter: Interpreters DDL statements and records the definition into
data dictionary.

• DML Compiler: Translates DML statements into an evaluation plan consisting


of low-level instructions that the query evaluation engine understands. It

translates the query into a number of evaluation plans. DML Compiler performs
query optimization i.e., selects the optimal evaluation plan for execution of

query.
• Query Evaluation Engine: Executes the low-level instructions generated by

DML compiler.

*************End of Unit-1*************

__________________________________________________________________________________
Ch. Vijayananda Ratnam @ Dept. of CSE 15

You might also like