Unit-1- Introduction to Database Management System
Unit-1- Introduction to Database Management System
Introduction to Database
Management System
Unit-1 1
Introduction of DBMS
• DBMS- Database Management System
• Database- Collection of data
• Collection of interrelated data and a set of
programs that allow users to access and modify
those data.
• Collection of programs that enables users to store,
modify, and extract information from a database.
Unit-1 2
Application of DBMS
B
E
A
U
T
y
Unit-1 3
Application of DBMS
Banking and finance
Enterprise Information
Airlines
Universities
Telecommunication
Unit-1 4
Application of DBMS
• Enterprise Information
– Sales: For customers, products and purchases
information.
– Online retailers: For online order tracking, customized
recommendations and maintain online product
evaluations.
– Human resources: For employee records, salaries, tax
deductions and benefits.
– Accounting: For payments, receipts, account balances
and other accounting information.
– Manufacturing: For production, inventory, supply chain
and orders for items.
Unit-1 5
Application of DBMS [Cont.]
• Banking and finance
– Banking: For customer information, accounts, loans and
banking transactions.
– Credit and Transactions: For purchases on credit cards
and generation of monthly statements.
– Finance: For storing information about holdings, sales,
purchases of stocks and real-time market data.
• Universities
– For students information, course registrations and
grades.
Unit-1 6
Application of DBMS [Cont.]
• Airlines
– For reservations and schedule information.
• Telecommunication
– For keeping records of calls, generating monthly bills,
maintaining balances and storing information about the
communication network.
Unit-1 7
Purpose of Database systems
A
D
D
D
I
C
t
S
Unit-1 8
Purpose of Database systems
• Atomicity problems:
• Data Redundancy and inconsistency:
• Difficulty in accessing data:
• Data isolation:
• Integrity problems
• Concurrent-access anomalies:
• Security problems:
Unit-1 9
Purpose of Database systems
• Atomicity problems:
– Failures may leave database in an inconsistent state
with partial updates carried out
– Example: Transfer of funds from one account to another
should either complete or not happen at all
• Data Redundancy and inconsistency: Multiple file
formats, duplication of information in different files
• Difficulty in accessing data: Need to write a new
program to carry out each new task
• Data isolation: Multiple files and formats
Unit-1 10
Purpose of Database systems
[Cont.]
• Integrity problems:
– Integrity constraints (e.g., account balance > 0) become
“buried” in program code rather than being stated explicitly
– Hard to add new constraints or change existing ones
• Concurrent-access anomalies:
– Concurrent access needed for performance
– Uncontrolled concurrent accesses can lead to inconsistencies
Example: Two people reading a balance (say 100) and
updating it by withdrawing money (say 50 each) at the
same time
• Security problems: Hard to provide user access to some, but
not all, data
Unit-1 11
View of Data
• Data Abstraction
• Data models
Unit-1 12
Data Abstraction
Unit-1 13
Data Abstraction
• Physical level:
– The lowest level of abstraction
– Describes how the data are actually stored.
• Logical level:
– The next-higher level of abstraction
– Describes what data are stored in the database, and
what relationships exist among those data.
• View level:
– The highest level of abstraction
– Describes only part of the entire database.
Unit-1 14
Instances and Schemas
• Instance- the actual content of the database at a
particular point in time
Unit-1 15
Data Independence
Data independence: ability
to modify the schema at
one level of the database
system without changing
the schema at the next
higher level.
There are two types of data
independence:
1. Logical Data Independence
2. Physical Data Independence
Unit-1 16
Physical Data Independence
• Ability to change the schema at physical level without
changing the schema at logical level.
• If we do any changes in the storage size of the database
system server, then the logical structure of the database will
not be affected.
• Physical data independence is used to separate logical
levels from the physical levels.
• Physical data independence occurs at the logical interface
level.
Unit-1 17
Logical Data Independence
• Ability to change the schema at logical level without
changing the schema at view/external level.
• Logical data independence is used to separate the
view/external level from the logical level.
• If we do any changes in the logical view of the data, then the
user view of the data would not be affected.
• Logical data independence occurs at the user interface level.
Unit-1 18
Data Models
• The logical structure of a database is the Data model.
• It provides the logical tools for describing the design of a
database at each level of data abstraction.
• Data models define how data is connected to each other,
how they are processed and stored inside the system.
• The data models can be classified into four categories:
[ROSE]
– Relational Model
– Object based Data Model
– Semi structured Data Model
– Entity-Relationship Model
Unit-1 19
Data Models
Relational 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.
Unit-1 20
Data Models
Semi structured Data Model
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.
Entity-Relationship Model
An Entity–relationship model (ER model) describes the
structure of a database with the help of a diagram, which is
known as Entity Relationship Diagram (ER Diagram).
An ER model is a design or blueprint of a database that can
later be implemented as a database.
The main components of E-R model are: entity set and
relationship set.
Unit-1 21
Database Languages
• Data-definition language (DDL)
• Data-manipulation language (DML)
Unit-1 22
Data Definition Language (DDL)
• Specification notation for defining the database schema
Example:
SCHEMA: Instructor(ID, name, dept_name, salary)
create table instructor (ID char(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2));
• Data dictionary contains metadata (i.e., data about data)
– Database schema
– Integrity constraints
• Primary key (ID uniquely identifies instructors)
– Authorization
• Who can access what
Unit-1 23
Data Manipulation Language
(DML)
• Express database queries and updates.
• Language for accessing and manipulating the data organized by the
appropriate data model.
• The types of access are:
– Retrieval of information
– Insertion of new information
– Deletion of information
– Modification of information
• DML also known as query language.
• Two classes of languages:
– Procedural DMLs: require a user to specify what data are needed
and how to get those data.
– Declarative DMLs: require a user to specify what data are needed
without specifying how to get those data.
Unit-1 24
Storage Management
• Storage manager is a program module that provides the interface
between the low-level data stored in the database and the application
programs and queries submitted to the system.
• The storage manager is responsible to the following tasks:
– Interaction with the OS file manager
– Efficient storing, retrieving and updating of data
“FB AT DID”
Unit-1 25
Storage Management [Cont.]
File manager
Buffer manager
Authorization and integrity manager
Transaction manager
Data files
Indices
Data dictionary
Unit-1 26
Storage Management [Cont.]
– File manager: manages the allocation of space on disk storage and
the data structures.
– Buffer manager: responsible for fetching data from disk storage
into main memory, and deciding what data to cache in main memory.
– Authorization and integrity manager: tests for the satisfaction of
integrity constraints and checks the authority of users to access data.
– Transaction manager: ensures that the database remains in a
correct state and that concurrent transaction.
Several data structure as a part of physical system
implementation:
• Data files: store the database itself.
• Data dictionary: stores metadata about the structure of the
database, in particular the schema of the database.
• Indices: provide fast access to data items.
Unit-1 27
The Query Processor
• The query processor components include:
– DDL interpreter: interprets DDL statements and records the
definitions in the data dictionary.
– DML compiler: translates DML statements in a query
language into low-level instructions.
– Query evaluation engine: executes low-level instructions
generated by the DML compiler.
Unit-1 28
Transaction Management
• Transaction is a collection of operations that performs a single
logical function in a database application
• Transaction-management component ensures that the
database remains in a consistent (correct) state despite system
failures (e.g., power failures and operating system crashes) and
transaction failures.
• Concurrency-control manager controls the interaction among
the concurrent transactions, to ensure the consistency of the
database.
• Recovery manager Ensures the atomicity and durability
properties of the database system.
• The transaction manager consists of the concurrency-control
manager and the recovery manager.
Unit-1 29
Database Architecture
Two-tier architecture:
In a two-tier architecture,
the application resides at the
client machine, where it
invokes database system
functionality at the server
machine through query
language statements.
Application program
interface standards like ODBC
and JDBC are used for
interaction between the client
and the server.
Unit-1 30
Database Architecture
Three-tier architecture:
In a three-tier architecture, the
client machine acts as a front end and
does not contain any direct database
calls.
Instead, the client end
communicates with an application
server,usually through forms interface.
The application server in turn
communicates with a database system
to access data.
Three-tier applications are more
appropriate for large applications, and
for applications that run on the
WorldWideWeb.
Unit-1 31
Database Users & DBA
• People who work with a database can be categorized as
database users or database administrators.
• There are four different types of database-system users,
differentiated by the way they expect to interact with the
system. [NASS]
– Naive users
– Application programmers
– Sophisticated users
– Specialized users
Unit-1 32
Database Users
• Naive users
– Unsophisticated users who interact with the system by
invoking one of the application programs that have been
written previously.
– The user interface for naive users is a forms interface,
where the user can fill in appropriate fields of the form.
– may also simply read reports generated from the
database.
Unit-1 33
Database Users
• Application programmers
– Computer professionals who write application
programs.
– can choose from many tools to develop user interfaces.
– Rapid application development (RAD) tools are tools
that enable an application programmer to construct
forms and reports with minimal programming effort.
Unit-1 34
Database Users [Cont.]
• Sophisticated users
– interact with the system without writing programs.
– form their requests either using a database query
language or by using tools such as data analysis
software.
– Analysts who submit queries to explore data in the
database fall in this category.
Unit-1 35
Database Users [Cont.]
• Specialized users
– sophisticated users who write specialized database
applications that do not fit into the traditional data-
processing framework.
– Among these applications are computer-aided design
systems, knowledgebase and expert systems, systems
that store data with complex data types and
environment-modeling systems.
Unit-1 36
Database Administrator
• A person who has central control over the system is called a
database administrator (DBA).
• The functions of a DBA include:
G
R
a
S
S
S
Unit-1 37
Database Administrator [Cont.]
– Granting of authorization for data access: By granting
different types of authorization, the database administrator
can regulate which parts of the database various users can
access.
– Routine maintenance: Examples of the database
administrator’s routine maintenance activities are:
o Periodically backing up the database
o Ensuring that enough free disk space is available for
normal operations and upgrading disk space as
required.
o Monitoring jobs running on the database
Unit-1 38
Database Administrator [Cont.]
– 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.
– Schema & physical organization modification: The DBA
carries out changes to the schema and physical
organization to reflect the changing needs of the
organization to improve performance.
Unit-1 39