DBMS Print
DBMS Print
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
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
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
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.
Introduction to DBMS
HRM
Accounts Production
Department Department Department
Data
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
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
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.
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.
Database systems provide capabilities for inferencing new information from the stored database
facts.
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
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
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
PREREQuIsITE
Courae eumbe
Figure 1.2 C83300 CS3320
42414
DBMS
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
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
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 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
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.
E-R diagram
Primary Primary
Key Attributes Key
RollNo Name Relationship BookNo Name
E-R diagram
Ternary Relationship
Project
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
Multiple Stored
Value
Phone No Birth Date Area