You are on page 1of 75

MSc.

(IT)

Database Management System

Semester - I

Copyright Amity University


Module 1. Introduction to DBMS

Definition of DBMS

DBMS Architecture

Levels

Data Independence

Database Administrator

Copyright Amity University


Module 1. Introduction to DBMS

File System Vs. DBMS Approach

Advantage of Using DBMS

Data Model

Schema and Instances

Copyright Amity University


Database Management System (DBMS)

Database: Collection of interrelated data.

Management: Managing various operations performed


over the database.

System: Collection of interdependent and inter-related


components to perform some specific operations.

DBMS contains information about a particular enterprise

Copyright Amity University


Database Management System (DBMS)

A software system that allows the users to define the


structure of database , store and maintain the data
into the database and provides controlled access to
the database.

A database management system is a complex piece of


software that usually consists of a number of modules.

Copyright Amity University


Database Management System (DBMS)

The DBMS may be considered as an agent that allows


communication between the various types of users with
the physical database and the operating system without
the users being aware of every detail of how it is done.

DBMS provides an environment that is both convenient


and efficient to use.

Copyright Amity University


Database Management System (DBMS)

To enable the DBMS to fulfill its tasks, the database


management system must maintain information about
the data itself that is stored in the system.

This information would normally include what data is


stored, how it is stored, who has access to what parts of
it and so on.

Commercially available DBMS : Oracle , DB2 ,MS-


ACCESS , Sybase, Foxpro.
Copyright Amity University
Database Applications:

Banking: all transactions

Airlines: reservations, schedules

Universities: registration, grades

Sales: customers, products, purchases

Manufacturing: production, inventory, orders, supply
chain
Human resources: employee records, salaries, tax
deductions
Databases touch all aspects of our lives

Copyright Amity University


Database Administrator (DBA)

A Database administrator (DBA) performs all activities


related to maintaining a successful database
environment.

DBA is said to be the custodian of Database.

DBA is a person or group of persons responsible for


managing the Database.

Copyright Amity University


Responsibility of DBA Includes:

Designing, implementing, and maintaining the database


system.
Establishing policies and procedures pertaining to the
management,

Security, maintenance, and use of the database


management system .

Training employees in database management and use.

Copyright Amity University


Database administrator (DBA)

A DBA is expected to be knowledgeable of emerging


technologies and new design approaches.

DBA has either a degree in Computer Science or some


on-the-job training with a particular database product or
more extensive experience with a range of database
products.

A DBA is usually expected to have experience with one


or more of the major database management products,
such as Structured Query Language, SAP, and Oracle-
based database.
Copyright Amity University
File System Vs. DBMS Approach

File-Based Approach : Each program defines and manages


its own data.

Drawbacks of using file systems to store data:

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
Copyright Amity University
File System Vs. DBMS Approach
Data isolation multiple files and formats.

Integrity problems:

Integrity constraints (e.g. account balance > 0)


become part of program code.

Hard to add new constraints or change existing


ones.

Copyright Amity University


Drawbacks of using file systems (cont.)

Atomicity of updates:

Failures may leave database in an inconsistent


state with partial updates carried out.

E.g. transfer of funds from one account to another


should either complete or not happen at all

Copyright Amity University


Drawbacks of using file systems (cont.)

Concurrent access by multiple users:

Concurrent accessed needed for performance.

Uncontrolled concurrent accesses can lead to


inconsistencies.
E.g. two people reading a balance and
updating it at the same time.
Security problems.

Copyright Amity University


Database Approach

Database Approach : A shared collection of logically


related data, designed to meet the information needs of
an organization.

Database systems offer solutions to all the above


problems.

Copyright Amity University


Advantages of DBMS

Controlled data redundancy:

Data consistency:

More information from the same amount of data

Sharing of data:

Copyright Amity University


Advantages of DBMS

Increased concurrency.

Improved data integrity:

Improved backup and recovery services

Copyright Amity University


Disadvantages of DBMS

- Complexity & Size,

- Cost of Software & Additional H/W costs

- Cost of conversion, Performance,

- Higher impact of a failure.

Copyright Amity University


Architecture of DBMS

Three-Tier / Three level architecture suggested by

ANSI / SPARC

Copyright Amity University


Architecture of DBMS

A commonly used views of data approach


is the three-level architecture suggested
by ANSI/SPARC (American National
Standards Institute/Standards Planning
and Requirements Committee).

Copyright Amity University


Architecture of DBMS

ANSI/SPARC produced a final report in 1977. The


reports proposed an architectural framework for
databases. Under this approach, a database is
considered as containing data about an enterprise.

The three levels of the architecture are three different


views of the data.

Copyright Amity University


Architecture of DBMS

Three-Level Database Architecture


External Level
The users view of the database.
Conceptual Level
The community view of the database
Internal Level
The physical representation of the database on
the computer.

Copyright Amity University


External level

The external level is the view that the individual user of


the database has.
This view is often a restricted view of the database and
the same database may provide a number of different
views for different classes of users.
In general, the end users and even the applications
programmers are only interested in a subset of the
database.

Copyright Amity University


External Level
For example:
A department head may only be interested in the
departmental finances and student enrolments but not
the library information.
The librarian would not be expected to have any interest in
the information about academic staff.
The payroll office would have no interest in student
enrolments

Copyright Amity University


Conceptual Level

The conceptual view is the overall community view of the


database and it includes all the information that is going
to be represented in the database.

The conceptual view is defined by the conceptual


schema which includes definitions of each of the various
types of data.

Copyright Amity University


Conceptual Level

The conceptual view is the information model


of the enterprise and contains the view of the
whole enterprise without any concern for the
physical implementation.
This view is normally more stable than the
other two views.

Copyright Amity University


Internal Level
The internal view is the view about the actual physical
storage of data.

It tells us what data is stored in the database and how.

At least the following aspects are considered at this


level:

Copyright Amity University


Internal Level
Storage allocation.

Access paths e.g. specification of primary and secondary


keys, indexes and pointers and sequencing.

Miscellaneous e.g. data compression and encryption


techniques, optimization of the internal structures.

Copyright Amity University


Architecture of DBMS

Copyright Amity University


Architecture of DBMS
Physical level describes how a record (e.g., customer) is
stored.
Logical level: describes data stored in database, and the
relationships among the data.
type customer = record
name : string;
street : string;
city : integer;
end;
View level: application programs hide details of data types.
Views can also hide information (e.g., salary) for security
purposes.

Copyright Amity University


Level for a database system

Copyright Amity University


Data Model

Information systems and computer sciences use data


modeling to manage and organize large quantities of
structured and unstructured data.

A data model describes the information to be stored in vast


database management systems like relational databases.

Data models do not include unstructured data such as


email messages, word processing documents.

Copyright Amity University


Data Model
Data modeling establishes implicit and explicit constrains
and limitations of the structured data.

Data Modeling Analysts use data modeling functions to


supply an accurate representation of the enterprise.

Data modeling is used to accurately reflect the data of


the organization. Based on this information, a database
is created.

Copyright Amity University


Data Model (Definition)
A generalized, user-defined view of data representing the
real world.

A description of the structure of data elements.

Collection of concepts allowing for the representation of an


environment according to arbitrary requirements.

A diagram that shows the various subjects about which


information is stored, and illustrates the relationships
between those subjects

Copyright Amity University


Data Model (Definition)
A logical map that represents the inherent properties of the
data independent of software, hardware or machine
performance considerations.

The model shows data elements grouped into records, as


well as the association around those records.

A data model is a collection of descriptions of data


structures and their contained fields, together with the
operations or functions that manipulate them.

Copyright Amity University


Types of Data Model

There are a number of data models that are used to describe how
a database is structures and used, these are:

Hierarchical Model.
Network Model.
Relational Model.
Object Relational Model.
Entity-Relationship Model

Copyright Amity University


Hierarchical Model.

The hierarchical data model organizes data in a tree


structure.
There is a hierarchy of parent and child data segments.
This structure implies that a record can have repeating
information, generally in the child data segments.
Data in a series of records, which have a set of field
values attached to it.
It collects all the instances of a specific record together
as a record type.

Copyright Amity University


Hierarchical Model.
These record types are the equivalent of tables in the
relational model, and with the individual records being
the equivalent of rows.

Today, the hierarchical model is rarely in modern


databases.
It is, however primarily used storing information, ranging
from geographic, file systems to the Windows registry to
XML documents.
IBM's Information Management System (IMS) DBMS,
were popular Hierarchical DBMSs .

Copyright Amity University


Network Model

The popularity of the network data model coincided with


the popularity of the hierarchical data model.

Some data were more naturally modeled with more than


one parent per child. So, the network model permitted
the modeling of many-to-many relationships in data.

In 1971, the Conference on Data Systems Languages


(CODASYL) formally defined the network model.

Copyright Amity University


Network Model

The basic data modeling construct in the


network model is the set construct. A set
consists of an owner record type, a set name,
and a member record type.

The data model is a simple network, and link


and intersection record types.

Copyright Amity University


Relational Model.

RDBMS (relational database management system)


A database based on the relational model developed
by E.F. Codd.
A relational database allows the definition of data
structures, storage and retrieval operations and
integrity constraints.
In such a database the data and relations between
them are organized in tables.
A table is a collection of records and each record in a
table contains the same fields.

Copyright Amity University


A Sample Relational Database

Copyright Amity University


A Sample Relational Database

Copyright Amity University


Object Relational Model

Object Relational Database Management Systems


(ORDBMS) add new object storage capabilities to the
relational systems at the core of modern information
systems.
These new facilities integrate management of traditional
fielded data, complex objects such as time-series and
geospatial data and diverse binary media such as audio,
video, images, and applets.
By encapsulating methods with data structures, an
ORDBMS server can execute complex analytical and
data manipulation operations to search and transform
multimedia and other complex objects.

Copyright Amity University


Entity-Relationship Model

E-R model of real world


Entities : Real world objects (Includes both
living or Non-living)
E.g. customers, accounts, branch.
Entities are of two types: Strong Entity and
Week Entity

Copyright Amity University


Entity-Relationship Model

Relationships: Association between instances of


entities
E.g. Account A-101 is held by customer Johnson
Relationship are of Three Types:
One-to-One (1:1)
One-to-Many (1:M)
Many-to-Many (M:N)

Copyright Amity University


Entity-Relationship Model

Most Widely used for database design

Database design in E-R model usually converted to


design in the relational model which is used for
s t o r a g e a n d p r o c e s s i n g

Copyright Amity University


Entity-Relationship Model

Copyright Amity University


Instances and Schemas

Schema the logical structure of the database


e.g., the database consists of information about a
set of customers and accounts and the
relationship between them.
Physical schema: database design at the
physical level.
Logical schema: database design at the logical
level

Copyright Amity University


Instances and Schemas

Instance the actual content of the database at a


particular point in time.

Analogous to the value of a variable


Occurrences of an Entity.
For Example: Name : John , City : Delhi and Age: 23

Copyright Amity University


Physical Data Independence

the ability to modify the physical schema without


changing the logical schema
Applications depend on the logical schema
In general, the interfaces between the various levels
and components should be well defined so that
changes in some parts do not seriously influence
others.

Copyright Amity University


Physical Data Independence

Alteration in the internal schema might


include.
* Using new storage device.
* Switching from one access method to
another.
Using different file organizations or storage
structures.
* Modifying indexes.

Copyright Amity University


Logical Data Independence:

Logical data independence is the ability to modify the


conceptual schema without having alteration in external
schemas or program.

Alterations in the conceptual schema may include:


Addition or deletion of fresh entities, Attributes or
relationships and should be possible without having
alteration to existing external schemas or having to
rewrite application programs.

Copyright Amity University


Functions of a DBMS
1.Data storage, retrieval, and update:
Support of Query Language
2. A user-accessible catalog:
Data Dictionary
3. Transaction support:
Transaction Manager
4. Concurrency control services:
Lock Manager
5. Recovery services.

Copyright Amity University


Functions of a DBMS

6. Authorization services
7. Support for data communication
8. Integrity services
9. Services to promote data independence

Copyright Amity University


Components of the DBMS Environment

Hardware
Software
Data -
Procedures
People

Copyright Amity University


Components of a DBMS
Programmers Users DBA
Application Database
Queries
Programs Schema

Query DDL DBMS


processor compiler
preprocessor

Program Database Dictionary


object code manager manager

Access File
methods manager

System Database and


buffers system catalog

Copyright Amity University


Category of Database User :

Database Designer or Administrator.

Application Programmer.

End User.

Copyright Amity University


Database Language

DDL: Data Definition Language.


DML: Data Manipulation Language.
DQL: Data Query Language.
DCL: Data Control Language

Copyright Amity University


DDL: Data Definition Language.
Example:
CREATE Statement.

ALTER ADD Statement.

ALTER DROP Statement.

ALTER MODIFY Statement

Copyright Amity University


DML: Data Manipulation Language.

Example:
Insert Statement.

Update Statement.

Delete Statement.

Copyright Amity University


DQL: Data Query Language

Example:

Select Statement.

With Where Clause.

With Order By Clause.

With group By Clause

Copyright Amity University


DCL: Data Control Language

Example:

Grant Statement.

Revoke Statement.

Copyright Amity University


Example: Creating Table:

CREATE TABLE STATION


(ID number(6) PRIMARY KEY,
CITY CHAR(20),
STATE CHAR(10),
zip_code number (6));

Copyright Amity University


Example: Inserting Data into Table:

INSERT INTO STATION


VALUES (13, 'Phoenix', 'AZ', 33112);

INSERT INTO STATION


VALUES (44, 'Denver', 'CO', 40105);

Copyright Amity University


Example: Retrieving Data from Table:

SELECT * FROM STATION;

SELECT ID, CITY FROM STATION;

SELECT STATE , CITY FROM STATION;

SELECT STATE , CITY FROM STATION


WHERE CITY = MUMBAI;

Copyright Amity University


DELETING Data from Table:

DELETE FROM STATION;

DELETE FROM STATION


WHERE PIN = 53461;

Copyright Amity University


ALTERING STRUCTURE OF TABLE

ALTER TABLE STATION


ADD EMAIL VARCHAR2(12)
ALTER TABLE STATION
MODIFY CITY VARCHAR2(20)

Copyright Amity University


Question & Answer
1. By data security in DBMS we mean
preventing access to data
allowing access to data only to authorized users
preventing changing data
introducing integrity constraints
2. Data independence allows:
sharing the same database by several applications
extensive modification of applications
no data sharing between applications
elimination of several application programs

Copyright Amity University


Question & Answer

3. Many to Many Relationship is represented by:


a) 1:1
b) M:M
c) N:N
d) M: N
4. Entities are defined as :
a) Real world object
b) Association among the instances
c) Property of attributes
d) Property of DBMS

Copyright Amity University


Question & Answer
5. By data redundancy in a file based system we mean that
(a) Unnecessary data is stored
(b) Same data is duplicated in many files
(c) Data is unavailable
(d) Files have redundant data

6. Overall logical structure of a database can be expressed


graphically by
(A). ER diagram
(B). Records
(C). Relations
(D). Hierarchy

Copyright Amity University


Question & Answer

7. . A table can have how many unique key


A). 1
B). any number
C). 255
D). None of the above.
8. Entity is represented by the symbol.
A) Double Circle
B) Ellipse
C) Rectangle
D) Square

Copyright Amity University


Question & Answer

9. Attributes are
i) Properties of relationship
ii) Degree to entities
iii) Properties of members of an entity set
(a ) i (b) i and ii (c) i and iii (d) iii
10 A relationship is
a) an item in an application
b) a meaningful dependency between entities
c) a collection of related entities
d) related data

Copyright Amity University


Thank You

You might also like