0% found this document useful (0 votes)
3 views12 pages

DBMS Print

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)
3 views12 pages

DBMS Print

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

Contents

Outline
Introduction of database
File processing system
Disadvantages of file processing system
Transition to Database management system
The desired characteristics of the database management system
Summary

Introduction to DBMS

Data - Fact that can be recorded or stored


e.g. Person Name, Age, Gender and Weight etc.
Database - Collection of logically related data
e.g. Books Database in Library, Student Database in University etc.
Management - Manipulation, Searching and Security of data
e.g. Viewing result in website, Searching exam papers in website etc.
System - Programs or tools used to manage database
e.g. SQL Server Studio Express, Oracle etc.
DBMS -ADatabase Management System is a software for creating and managing databases.
Database Management System (DBMS) is a software designed to define, manipulate, retrieve and
manage data in a database.
e.g. MS SQL Server, Oracle, My SQL, SQLite, MongoDB etc.

Introduction to DBMS

Applications of DBMs
DBMS isa computerized record-keeping system.
DBMS is required where ever data need to be stored.
E-Commerce (Flikart, Amazon, Shopclues, eBay etc...)
Online Television Streaming (Hotstar, Amazon Prime etc...)
Social Media (WhatsApp, Facebook, Twitter, Linkedin etc..)
Banking & Insurance
Airline & Railway
Universities and Colleges/Schools
Library Management System
Human Resource Department
Hospitals and Medical Stores
Government Organizations

Introduction to DBMS

File-processing system
HRM
The system stores permanent records in various files Accounts Production
Department Department Department
It needs different application programs to
Add records
Find the existing record
Modify the existing records
Extract record

University records, HR Production


Accounts
The grade reporting office, Data Data Data
may keep files of students and their grades.
Programs to print a student's transcript and to enter new grades.
The accounting office,
may keep track of students' fees and their payments. Each department maintain their own set of data. There is no link between those data pools.

Although both users are interested in data about students,


Each user maintains separate files-and programs to manipulate these files.
This make redundancy in defining and storing data
Introduction to DBMS

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

Data isolation
Multiple files and formats
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

Introduction to DBMS

Drawbacks of using file systemsto store data


Atomicity problems
It is essential in database that either complete query to be executed, or none.
It is difficult to ensure atomicity in a conventional file-processing system.
Concurrent-access anomalies
For faster response, many systems allow multiple users to update the data simultaneously.
In such an environment, interaction of concurrent updates is possible and may result in inconsistent data.

Security problems
Not every user of the database system should be able to access all the data.
As application programs are added to the file-processing system in an ad hoc manner, enforcing such security
constraints is difficult.

Data based system offer solutions to allthe above problems

Introduction to DBMS

How DBMS works?

HRM
Accounts Production
Department Department Department

Data

Introduction to DBMS

Characteristics of the Database Approach


In the database approach, a single repository maintains data.
It should be accessed by various users repeatedly through queries, transactions, and application
programs.
The main characteristics of the database approach are:
Self-describing nature of a database system
Insulation between programs and data, and data abstraction
Support of multiple views of the data
Sharing of data and muitiuser transaction processing
Introduction to DBMS

Example of a Database:

COURSE CourseName CourseNumber Cred1tHours Department GRADE REPORT StudentNumber Sectionldentitier Grade
Intro to Computer Science CS1310 4 CS 7 112

Data Structures CS3320 CS 17 119

Discrete Mathermatics MATH2410 MATH A

Database CS33A0 3 CS
102

135
SECTION Sectionldentifier CourseNumber Semester Year Instructor
84 MATH2410 Fall King
CS1310 Fall Anderson PREREQUISITE CourseNumber PrerequisiteNumber
CS3380 CS3320
102 CS3320 Spring Knuth
Fal CS3380 MATH2410
112 MATH2410 Chang
119 CS1310 Fal 99 CS3320 CS1310
Anderson
135 CS3380 Fal Stone

Introduction to DBMS

Insulation between Programs and Data


In traditional file processing, the structure of data files is embedded in the application programs.
So any changes to the structure of a file may require changing all programs that access that file.
In DBMS, structure of data files is stored separately from the access programs.
Support of Multiple Views of the Data

DBMS Architecture

DBMSArchitecture
The DBMS design depends upon its architecture.
This architecture consists of many PCs and a workstation which are connected via the network.
DBMS architecture depends upon how users are connected to the database to get their request
done.
DBMS
Architecture

1-tier 3-tler
2-tier
Architecture Architecture
Architecture

DBMS Architecture

1-Tier Architecture
The database is directly available to the user.
Any changes done here will directly be done on the database itself.
The 1-Tier architecture is used for development of the local application,where programmers can
directly communicate with the database for the quick response.
E.g. you installa Database in your system and access it to practice SQL queries
DBMS Architecture

2-Tier Architecture

Server
Database system

Application
Client

User

DBMS Architecture

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.
E.g. A Contact Management System created using MS- Access.

DBMS Architecture

3-Tier Architecture

Database
Server

Application Server

Application Client
Client

User

DBMS Architecture

3-Tier Architecture
The 3-Tier architecture contains another layer between the client and server.
Here, 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 systenm.
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.
Advantages of the DBMS Approach

Controlling Redundancy
In file processing, every user group maintains its own files for handling its data-processing
applications.
Redundancy introduces following problems:
Duplication of effort
Storage space is wasted
Data inconsistency
The different user groups are integrated to store and update each logical data item only one
place in the database.

Advantages of the DBMS Approach

Providing Efficient Query Processing


Database is typically stored on disk.
DBMS must provide specialized data structures and search techniques to speed up disk search
for the desired records.
The query processing and optimization module of the DBMS is responsible for choosing an
efficient query execution plan for each query based on the existing storage structures.
Providing Backup and Recovery
DBMS must provide facilities for recovering from hardware or software failures.
The backup and recovery subsystem of the DBMS is responsible for recovery.

Advantages of the DBMS Approach

Providing Multiple User Interfaces


DBMS should provide a variety of user interfaces according to the users with varying levels of technical
knowledge.
Apps for mobile users
Query languages for casual users.
Programming language interfaces for application programmers.
Menu-driven interfaces and natural language interfaces for standalone users.
Representing Complex Relationships among Data
database may include numerous varieties of data that are interrelated in many
ways.
DBMS must have the capability to represent variety of complex relationships
among the data, to define new relationships as they arise, and to retrieve and
update related data easily and efficiently.

Advantages of the DBMS Approach

Enforcing Integrity Constraints


The database applications have certain integrity constraints that must hold for the data.
The simplest type of integrity constraint involves specifying a data type for each data item.
Permitting Inferencing

Database systems provide capabilities for inferencing new information from the stored database
facts.

Such systems are called deductive database systems.


Advantages of the DBMS Approach

Restricting Unauthorized Access


We can not allow all users to access allinformation in the database.
A DBMS should provide a security and authorization subsystem
Where DBA creates accounts and specifies account restrictions
Then DBMS should enforce these restrictions automatically

Advantages of the DBMS Approach

Restricting Unauthorized Access


We can not allow all users to access all information in the database.
A DBMS should provide a security and authorization subsystem
Where DBA creates accounts and specifies account restrictions
Then DBMS should enforce these restrictions automatically

DBMS

Outlines
Data model
Categories of the data model
Database schemas
Database state
Three-Schema Architecture

Data Independence
Summary

DBMS

Data Models
Data models define how the logical structure of a database is modeled.
Data Models are fundamental entities to introduce abstraction in a DBMS.

Data models define how data is connected to each other and how they are processed and stored
inside the system
Types of Data Models:
Hierarchical Model
Network Model
Entity-Relationship Model
Relational Model
Object-based Data Model
DBMS

Hierarchical Model
The data should be in a hierarchical pattern i.e. parent-child relationship must be present.
The data in a hierarchical pattern must be accessed through a single path onl
ot Node
S id S name S age
Boha

C1

mon Perl
Rer

Features
One-to-many relationship
Parent-Child Relationship
Deletion Problem C Name

Pointers

DBMS

Network Model
Extension of the hierarchical model
Record can have more than one parent
College

Features
Ability to Merge more Relationships CSE
Many paths Department Library
Circular Linked List

Student

Network Model

DBMS

E-R Model
Entity-Relationship Model or simply ER Model is a high-level data model diagram
In this model, we represent the real-world problem in the pictorial form.
It is also very easy for the developers to understand the system by just looking at the ER diagram.
We use the ER diagram as a visual tool to represent an ER Model.

DBMS

E-R Model

Teacher name Teacher id Dept_id


Features
Graphical Representation for Better Understanding
Helps to Design Database
Works
Teacher Department
for

Mobile_no Salary Dept name

Age
Entity-Relationship
Model
DBMS

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 tha fam nf aa nd oali mn
Emp_id Emp name Job name SalaryMobile_ no Dep_id Project_id
Features
AfterA001 John Engineer 100000 9111037890 2 99
Simple
Scalable
AfterA002 Adam Analyst 50000 9587569214 3 100
Structural Independence
AfterA003 Kande Manager 890000 7895212355 2 65

EMPLOYEE TABLE

DBMS

Obiect-Based Model
Real-world problerms are more closely represented through the object-based i.e. object-oriented
data model.

Both the data and relationship are present in a single structure known as an object.
In this model, twO are more objects are connected through links. We use this link to relate one
object to other objects. Employee Department
Attributes Attributes
Name
JobTitle Dept id
Phone no Dept name
Dept id
Methods Methods
Get Hired
Change Number Change Department

Object_Oriented_Model

DBMS

Data models describes a set of concepts


Structure of a database
Elements and their data types
Records consisting of groups of elements
Relationships among the records
Operations for manipulating these structures
Retrievals and updates
Certain constraints that the database should obey

DBMS

Database Schema
It is important to distinguish between the description of the database and the database itself.
The description of a database is called the database schema.
Includes descriptions of the database structure, data types, and the constraints on the database.
It is specified during database design and is not expected to change frequently.
DBMS
Example of asimple database Example of a database Schema
coURsE
Cours Cournenmbe TOrede hours Departm
to Cormputer
Dete
Discrete Mather MATH2410 MATH STUDENT Flqure 2.1
Dat Schema dagram for the
NameStudent number Class Major database in Fiqure 1.2.
SECTION
tfer Course nu Semester Vear netructor
cOURSE
MATHA10 Eall Kng Course_name Course_number Credit_ hoursDepartment
CSI310 04

PREREOUISITE
MATH241o
19
136
CS131o
CS338o
Falt Course number Prerequisite_number
SECTION
GRAPE HEPORT
T Secton identifer Section identifier Course number Sernester Year Instructor
112

eless GRADE_ REPORT


Student number Section identifer Grade
102
138

PREREQuIsITE
Courae eumbe
Figure 1.2 C83300 CS3320
42414

DBMS

Database State or Instance

The data in the database at a particular mnoment in time is called a database state or snapshot.
It changes every time we add new data in database.
It is also called the current set of OCcurrences instances in
the database.
The term instance is also applied to individual database components, e.g. record instance, table instance, entity
instance.
A state that satisfies the structure and constraints of the database is called valid state

Three-Schema Architecture

Three-Schema Architecture
User 1 User 2
Logal cardt Logical cord 2
Figure 2.2
The three-schema End Users
architecture. Address

External External Macong


External Level
View Vew Studert Roll No : integer
Student Name : string
External/Conceptual Student Address : string
Mapping Student Semester :integer

Conceptual Level Conceptual Schema Student Department : string


Course : string
Conceptual/ lnternal
Mapping Conceptualinternal DBMS
Mapping
Internal Level Internal Schema

H
Roll No :5 dec
Name : String Length 30
Address : String Length 100
Internt
Ve
Semester:2 dec
Stored Database Department: String Length 25
Course : String Lenght 20 core

Three-Schema Architecture

Defines DBMS schemas at three levels:


Internal schema at the internal level to describe physical storage structures, access paths (e.g
storage space allocation and indexes) and Data compression and data encryption techniques
Typically uses a physical data model.
Conceptual or logical schema at the conceptual level to describe the structure, constraints and
security for the whole database
The conceptual schema hides the details of physical storage structures.
Uses a conceptual or an implementation data model.
External schemas (view schemas) describes the database part that a particular user group is
interested and hides the remaining database from that user group.
The view schema describes the end user interaction with database systems.
Usually uses the same data model as the conceptual schema.
Three-Schema Architecture

Three-Schema Architecture
Mappings among schema levels are needed to transform requests and data.
External/Conceptual Mapping
It maps logical record in the external view to one or more conceptual records in conceptual view. (e.g last and
first name at conceptual and name at external)

Conceptual/lnternal Mapping
It maps the actual record or combination of records in the physical storage that constitute a logical record in
conceptual schema.

Data Independence

Data Independence
Logical Data Independence:
The capacity to change the conceptual schema without having to change the external schemas and their
associated application programs.
Physical Data Independence:
The capacity to change the internal schema without having to change the conceptual schema.
For example, the internal schema may be changed when certain file structures are reorganized or new indexes are created to improve
database performance.
Then only the mappings between this schema and higher-level schemas need to be changed in a DBMS.
The application programs need not be changed since they refer to the external schemas.

Basic concept of E-R diagram

Basic concepts
What is Database Design?
Database Design is a collection of processes that facilitate the designing, development, implementation and
maintenance of enterprise database management systems.
What is E-R diagram?
E-R diagram: (Entity-Relationship diagram)
It is graphical (pictorial) representation of database.
It uses different types of symbols to represent different objects of database.

E-R diagram

Entity
Entity Name
An entity is a person, a place or an object.
An entity is represented by a rectangle which contains the name of an entity.
Entities of a college database are:
Student
Course Faculty Student
Professor/Faculty
Course
Department
Result
Class
Subject
E-R diagram

Attributes
Attribute
Attribute is properties or details about an entity. Name

An attribute is represented by an oval containing name of an attribute.


Attributes of Student are:
Roll No RollNo Name
Student Name
Branch
Semester Student
Address
Mobile No
Age
Backlogs

E-R diagram

Relationship
Relationship is an association (connection) between several entities. Relationship
Name
It should be placed between two entities and a line connecting it to an entity.
Arelationship is represented by a diamond containing relationship's name.

Student Issue Book

E-R diagram

E-R Diagram of aLibrary System

Primary Primary
Key Attributes Key
RollNo Name Relationship BookNo Name

Student Issue Book

Branch Sem Entities Author Price

E-R diagram

Ternary Relationship

ProjectiD Project Name

Project

FaciD Name RollNo Name

Faculty Guide Student

Branch Technology Branch Sem


E-R diagram

Types of Attributes
Simple Attribute Roll No Age Student ID
Cannot be divided into subparts
E.g. RollNo, CPI
Composite Attribute
Can be divided into subparts
Name Name

(first name, middle name, last name) First name Last name
Address
(street, road, city)
Middle name

E-R diagram

Iypes of Attributes
Single-valued Attribute Roll No Age Student ID
Has single value
E.g. RollNo, CPI
Multi-valued Attribute
Has multiple (more than one) value
PhoneNo Phone No
(person may have multiple phone nos)
EmaillD
(person may have multiple emails)

E-R diagram

Types of Attributes
Stored Attribute
It's value is stored manually in database Birthdate
E.g. Birthdate

Derived Attribute
t's value is derived or calculated from other attributes
Age 4. Age
(can be calculated using current date and birthdate)

E-R diagram
Entity with all types of Attributes
Middle
Name
First Name Last Name
Single
Value
RollNo Name Composite Apartment
Derived Composite

(Age Student Address Street

Multiple Stored
Value
Phone No Birth Date Area

You might also like