0% found this document useful (0 votes)
34 views23 pages

Unit 1

Uploaded by

shaikhsubuktgin
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)
34 views23 pages

Unit 1

Uploaded by

shaikhsubuktgin
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/ 23

UNIT-I

1. Introduction of DBMS

1.1 Introduction, Definition

• A database management system (DBMS) refers to the technology for creating and
managing databases.
• DBMS is a software tool to organize (create, retrieve, update, and manage) data in
a database.
• The main aim of a DBMS is to supply a way to store up and
retrieve database information that is both convenient and efficient.
• Database Management System (DBMS) is a software for storing and retrieving users'
data while considering appropriate security measures.
• It consists of a group of programs which manipulate the database.
• The DBMS accepts the request for data from an application and instructs the operating
system to provide the specific data.
• In large systems, a DBMS helps users and other third-party software to store and retrieve
data.
• DBMS allows users to create their own databases as per their requirement. The term
“DBMS” includes the user of the database and other application programs.
• It provides an interface between the data and the software application.

*Application of DBMS:

Sector Use of DBMS

Banking For customer information, account activities,


payments, deposits, loans, etc.

Airlines For reservations and schedule information.

Universities For student information, course registrations,


colleges and grades.
Telecommunication It helps to keep call records, monthly bills,
maintaining balances, etc.

Finance For storing information about stock, sales,


and purchases of financial instruments like
stocks and bonds.

Sales Use for storing customer, product & sales


information.

Manufacturing It is used for the management of supply chain


and for tracking production of items.
Inventories status in warehouses.

HR Management

1.2 Characteristics of Database Management System


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

• Providing Backup and Recovery.

• Provides security and removes redundancy
1.3 File Processing System Vs DBMS

File processing system Database Management System


1) PC-based small system. 1) Mini-mainframe based large systems.

2)Relatively cheap. 2) Relatively expensive.

3) Less numbers of files used.. 3) More numbers of files used.

4) Single user system. 4) Single user system.

5)Data redundancy and Inconsistency 5) Data is independent non redundant.

occur.

6)Data access is difficult. 6)Data access is efficient.

7) Data is isolated. 7) Data is integrated.

8)Concurrent access to a file is not 8)Concurrent access and crash recovery

Possible. Possible.

9) Little preliminary design. 9) Vast preliminary design.

10) Security problems. 10) Better Security.

11)e.g. C++,COBOL,VB. 11)e.g Oracle, Postgress.

12) File system data sharing is not 12)DBMS offers features of data sharing

powerful as DBMS. Efficiently.

13) Transaction concept is not used. 13) The concept of transaction is important

aspect of DBMS.
1.4 Advantages and Disadvantages of DBMS

Advantages

1. Cost of software development is reduced.

2. User can get proper logical organization of dataset.

3. Centralization for multi-user is available.

4. Centralized data reduces management problems and duplication of also.

5. Data is independent.

6. User can monitor database performance.

7. Data redundancy and consistency are controllable.

8. Data integrity and its quality is maintained.

9. Data flexibility is increased.

10.Inconsistency of data is avoided.

11. Same data can be shared by many application programs.

12. Security to data is provided.

Disadvantages

1. Cost of software and hardware is more.

2. Problems with backup and recovery of database.

3. Problems with centralized data.

4. Lots of space and memory.

5.Technical staff requirements .


1.5 Users of DBMS
➢ Database Administrators (DBA)
• Database Administrators has overall control on everything related to database.
• He is responsible for administering the resources like database, the objects in database,
authentications to use data co-ordinating and monitoring controlling the use , acquiring
software and hardware resources.

➢ Database Designers
• Database Designers are responsible for designing the database objects.
• The database objects like tables, columns, their data types, forms and reports.
• Ones the database design is complete they assist DBA.

➢ Application Programmers
• These people write the codes of the programs according to the designs suggested by
the database designers.
• They also test, debug, document and maintain these programs.
• The person who develops the application is called s Application Developer.

➢ End Users:
• The end users are the people who interact with the database management system.
• They conduct various operations on database like retrieving, updating, deleting, etc.
• End Users of database:
❖ Casual end users: They are typically high or middle level managers.
❖ Naive or Parametric end users: Production supervisor or store-keeper at a
factory reservation clerks for airlines, railways.
❖ Sophisticated end users: business analysts, consultants, scientists etc.
❖ Stand alone users: These users maintain personal database by using readymade
program packages.
1.6 Structure of DBMS

Authorization and
Integrity Manager

Fig: System structure of DBMS or DBMS engine


Components of DBMS Structure are broadly classified as follows :

1. Query Processor Components :

• DML Pre-compiler: It translates DML statements in a query language into low level
instructions that query evaluation engine understands. It also attempts to transform user's request
into an equivalent but more efficient form.

• Embedded DML Pre-compiler: It converts DML statements embedded in an application


program to normal procedure calls in the host language. The Pre-compiler must interact with the
DML compiler to generate the appropriate code.

• DDL Interpreter: It interprets the DDL statements and records them in a set of tables
containing meta data or data dictionary.

• Query Evaluation Engine: It executes low-level instructions generated by the DML compiler.

2. Storage Manager Components :


They provide the interface between the low-level data stored in the database and application
programs and queries submitted to the system.

• Authorization and Integrity Manager: It tests for the satisfaction of integrity constraints
checks the authority of users to access data.

• Transaction Manager: It ensures that the database remains in a consistent state despite the
system failures and that concurrent transaction execution proceeds without conflicting.

• File Manager: It manages the allocation of space on disk storage and the data structures used
to represent information stored on disk.

• Buffer Manager: It is responsible for fetching data from disk storage into main memory and
deciding what data to cache in memory.
3. Data Storage:
Following data structures are required as a part of the physical system implementation.

• Data Files : It stores the database.

• Data Dictionary : It stores meta data (data about data) about the structure of the database.

.
• Indices : Provide fast access to data items that hold particular values.

• Statistical Data: It stores statistical information about the data in the database. This information
is used by query processor to select efficient ways to execute query.

1.7 View of Data


How data is actually store in data base. What data and data structure of data used by database for
data.

The view level provides the “view of data” to the users and hides the irrelevant details such as
data relationship, database schema, constraints, security etc from the user.

1. Data abstraction
2. Instance and schema

*Data Abstraction

• Abstraction is one of the main features of database systems.


• Database systems are made-up of complex data structures.

To ease the user interaction with database, the developers hide internal irrelevant details from
users. This process of hiding irrelevant details from user is called data abstraction.
There are three level of Data abstraction:

Physical / Internal level: This is the lowest level of data abstraction. It describes how data is
actually stored in database. You can get the complex data structure details at this level.

Logical / Conceptual level: This is the middle level of 3-level data abstraction architecture. It
describes what data is stored in database.

View / External level: Highest level of data abstraction. This level describes the user interaction
with database system.
* Schema

Definition of schema: Design of a database is called the schema.

Schema is of three types: Physical schema, logical schema and view schema.

❖ Physical schema: The design of a database at physical level is called physical schema, how
the data stored in blocks of storage is described at this level.

❖ Logical schema: Design of database at logical level is called logical schema. Programmers
and database administrators work at this level, at this level data can be described as certain
types of data records gets stored in data structures.

❖ View schema: Design of database at view level is called view schema. This generally
describes end user interaction with database systems.

*Instance

• Definition of instance: The data stored in database at a particular moment of time is


called instance of database.
• Database schema defines the variable declarations in tables that belong to a particular
database; the value of these variables at a moment of time is called the instance of that
database.
1.8 DBMS languages
• Database languages are used to read, update and store data in a database.
• There are several such languages that can be used for this purpose; one of them is SQL
(Structured Query Language).

Types of DBMS languages:

1. Data Definition Language (DDL)

2. Data Manipulation Language (DML)

3. Data Control Language (DCL)

4. Transaction Control Language(TCL)

1. Data Definition Language (DDL)

DDL is used for specifying the database schema. It is used for creating tables, schema, indexes,
constraints etc. in database. Lets see the operations that we can perform on database using DDL:

• To create the database instance – CREATE


• To alter the structure of database – ALTER
• To drop database instances – DROP
• To delete tables in a database instance – TRUNCATE
• To rename database instances – RENAME
• To drop objects from database such as tables – DROP
• To Comment – Comment

All of these commands either defines or update the database schema that’s why they come under
Data Definition language.

2. Data Manipulation Language (DML)

DML is used for accessing and manipulating data in a database. The following operations on
database comes under DML:

• To read records from table(s) – SELECT


• To insert record(s) into the table(s) – INSERT
• Update the data in table(s) – UPDATE
• Delete all the records from the table – DELETE
3. Data Control language (DCL)

DCL is used for granting and revoking user access on a database –

• To grant access to user – GRANT


• To revoke access from user – REVOKE

GRANT : An authorized user may pass authorized to other users.

This process is called GRANT.

REVOKE: We can reject privileges given to particular user with help of REVOKE stamen.

4. Transaction Control Language(TCL)

The changes in the database that we made using DML commands are either performed or
rollbacked using TCL.

• To persist the changes made by DML commands in database – COMMIT


• To rollback the changes made to the database – ROLLBACK

1. COMMIT : COMMIT in SQL is a transaction control language which is used to
permanently save the changes done in the transaction in tables/databases. The
database cannot regain its previous state after the execution of it.

2. ROLLBACK : ROLLBACK in SQL is a transactional control language which is


used to undo the transactions that have not been saved in database.

The command is only be used to undo changes since the last COMMIT.
1.9 Index
Introduction

➢ Indexing is a data structure technique to efficiently retrieve records from the database
files based on some attributes on which the indexing has been done.

➢ Indexing in database systems is similar to what we see in books.

➢ A database index is a data structure that improves the speed of data retrieval operations
on a database table at the cost of additional writes and storage space to maintain
the index data structure.

➢ Some databases extend the power of indexing by letting developers create indexes on
functions or expressions.

➢ Index file should be small than Main file. Otherwise it will take more time find the data.

➢ If index record size is small then it is beneficial for DBMS.

Types of Indexing

Type of Indexes in Database


Indexing in Database is defined based on its indexing attributes. Two main types of indexing
methods are:

• Primary Indexing
• Secondary Indexing

✓ Primary Index:

Primary Index is an ordered file which is fixed length size with two fields.

The first field is the same a primary key and second, filed is pointed to that specific data
block.

In the primary Index, there is always one to one relationship between the entries in the index
table.

The primary Indexing in DBMS is also further divided into two types.

• Dense Index
• Sparse Index

1) Dense Index:

In a dense index, a record is created for every search key valued in the database.

This helps you to search faster but needs more space to store index records. In this Indexing,
method records contain search key value and points to the real record on the disk.
2) Sparse Index

It is an index record that appears for only some of the values in the file. Sparse Index helps you
to resolve the issues of dense Indexing in DBMS.

In this method of indexing technique, a range of index columns stores the same data block
address, and when data needs to be retrieved, the block address will be fetched.

However, sparse Index stores index records for only some search-key values. It needs less space,
less maintenance overhead for insertion, and deletions but It is slower compared to the dense
Index for locating records.

Below is an database index Example of Sparse Index


✓ Clustering Index:

In a clustered index, records themselves are stored in the Index and not pointers. Sometimes
the Index is created on non-primary key columns which might not be unique for each record. In
such a situation, you can group two or more columns to get the unique values and create an index
which is called clustered Index. This also helps you to identify the record faster.

Example:

Let's assume that a company recruited many employees in various departments. In this case,
clustering indexing in DBMS should be created for all employees who belong to the same dept.

It is considered in a single cluster, and index points point to the cluster as a whole. Here,
Department _no is a non-unique key.

✓ Secondary Index:

The secondary Index in DBMS can be generated by a field which has a unique value for each
record, and it should be a candidate key. It is also known as a non-clustering index.

This two-level database indexing technique is used to reduce the mapping size of the first level.
For the first level, a large range of numbers is selected because of this; the mapping size always
remains small.
Example of secondary Indexing

Let's understand secondary indexing with a database index example:

In a bank account database, data is stored sequentially by acc no; you may want to find all
accounts in of a specific branch of ABC bank.

Here, you can have a secondary index in DBMS for every search-key. Index record is a record
point to a bucket that contains pointers to all the records with their specific search-key value.
1.10 File Organization

o The File is a collection of records. Using the primary key, we can access the records. The
type and frequency of access can be determined by the type of file organization which
was used for a given set of records.
o File organization is a logical relationship among various records. This method defines
how file records are mapped onto disk blocks.
o File organization is used to describe the way in which the records are stored in terms of
blocks, and the blocks are placed on the storage medium.
o The first approach to map the database to the file is to use the several files and store only
one fixed length record in any given file. An alternative approach is to structure our files
so that we can contain multiple lengths for records.
o Files of fixed length records are easier to implement than the files of variable length
records.

* Objective of file organization


o It contains an optimal selection of records, i.e., records can be selected as fast as possible.
o To perform insert, delete or update transaction on the records should be quick and easy.
o The duplicate records cannot be induced as a result of insert, update or delete.
o For the minimal cost of storage, records should be stored efficiently.

File Organization

Sequential Heap File Hash File Cluster File


File Organization Organization Organization
Organization
A. Sequential File Organization:

• This method is the easiest method for file organization.


• In this method, files are stored sequentially.
• This method can be implemented in two ways:

1. Pipe File Method:

2.

* Insertion of the new record:

2. Sorted File Method:

* Insertion of the new record:


B. Heap File Organization:

• It is the simplest and most basic type of organization.


• It works with data blocks.
• In heap file organization, the records are inserted at the file's end.
• When the records are inserted, it doesn't require the sorting and ordering of records.

* Insertion of the new record:


C. Cluster File Organization:

• When the two or more records are stored in the same file, it is known as clusters.
• These files will have two or more tables in the same data block, and key
attributes which are used to map these tables together are stored only once.
D. Hash File Organization:

• Hash File Organization uses the computation of hash function on some fields
of the records.
• The hash function's output determines the location of disk block where the
records are to be placed.

* Insertion of the new record:

1.11 Data Models :

• Data Model is the modeling of the data description, data semantics, and consistency
constraints of the data.
• It provides the conceptual tools for describing the design of a database at each level of
data abstraction.
• Therefore, there are following four data models used for understanding the structure of
the database:
1) 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.

2) 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.

3) 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.

4) Semistructured Data Model:

▪ This type of data model is different from the other three data models.
▪ The semistructured data model allows the data specifications at places where the
individual data items of the same type may have different attributes sets.

You might also like