CSE2004 - Database Management Systems
CSE2004 - Database Management Systems
Dr. S.L.Jayalakshmi
SCOPE
Chennai
Book(s)
2
Text Book:
Fundamentals of Database Systems by Ramez Elmasri and
Shamkant B.Navathe Pearson Education,2013.
Reference Books:
Database Management Systems by Raghu Rama Krishnan,
Tata Mcgraw Hill, 2010.
Database System Concepts by Abraham Silberschatz, Henry
F.Korth and S.Sudarshan, Tata Mc Graw Hill, 2011
Database System Design and Implementation by Rob
Cornell,cennage learning, 2011
3
Data
Database
Mini-world
Database management System (DBMS)
Database System
Image Source: https://www.theteflcentre.com/news/skills-reading-6-tasks-for-
reading-activities-matching-words-to-definitions
Definitions 6
Data are facts that are known and that can be recorded and that
have implicit meaning.
Database:The collection of data, usually referred to as the
database, contains information relevant to an enterprise.
Miniworld: It represents some aspect of the real (or an imagined)
world, called the miniworld or universe of discourse
A database-management system (DBMS) is a collection of
interrelated data and a set of programs to access those data.
The primary goal of a DBMS is to provide a way to store and retrieve
database information that is both convenient and efficient.
Database system : Database together with the DBMS software is
referred to as a database system
Basic Definitions 7
Database
A collection of related data.
Data
Known facts that can be recorded and
have an implicit meaning.
Image Source: https://analyticsindiamag.com/10-best-data-cleaning-tools-get-data/
Basic Definitions 9
Mini-World
Some part of the real world about which data
is stored in a database. For example, student
grades and transcripts at a university.
Image Source: https://store.steampowered.com/app/814480/Mini_World_Block_Art/
Basic Definitions 10
Database System
The DBMS software together with the data
itself. Sometimes, the applications are also
included.
Image Source: https://www.quora.com/What-is-database-system
Basics
12
and Database
Applications
and Database
Applications
Traditional Applications:
Numeric and Textual Databases
More Recent Applications:
Multimedia Databases
Geographic Information Systems (GIS)
Data Warehouses
Real-time and Active Databases
Many other applications
Traditional applications 15
Banking: For customer information, accounts, and loans, and banking transactions.
Airlines: For reservations and schedule information. Airlines were among the first to use databases in a
geographically distributed manner—terminals situated around the world accessed the central database system
through phone lines and other data networks.
Universities: For student information, course registrations, and grades.
Credit card transactions: For purchases on credit cards and generation of monthly statements.
Telecommunication: For keeping records of calls made, generating monthly bills, maintaining balances on prepaid
calling cards, and storing information about the communication networks.
Finance: For storing information about holdings, sales, and purchases of financial instruments such as stocks and
bonds.
Sales: For customer, product, and purchase information.
Manufacturing: For management of supply chain and for tracking production of items in factories, inventories of
items in warehouses/stores, and orders for items.
Drawbacks of using file systems to store data:
16
Difficulty in accessing data - In order to retrieve, access and use stored data,
need to write a new program to carry out each new task.
Data isolation - To isolate data we need to store them in multiple files and
different formats.
E.g. transfer of funds from one account to another should either complete or
not happen at all
Typical Database 17
Functionalities
18
More specifically, a DBMS is a general purpose software system
facilitating each of the following (with respect to a database):
Definition: specifying data types (and other constraints to which the
data must conform) and data organization
Construction: the process of storing the data on some medium (e.g.,
magnetic disk) that is controlled by the DBMS
Manipulation: querying, updating, report generation
Sharing: allowing multiple users and programs to access the database
"simultaneously"
System protection: preventing database from becoming corrupted
when hardware or software failures occur
Security protection: preventing unauthorized or malicious access to
database
Example of a 19
Database
Mini-world for the example:
Part of a UNIVERSITY environment.
Some mini-world entities:
STUDENTs
COURSEs
SECTIONs (of COURSEs)
(academic) DEPARTMENTs
INSTRUCTORs
Example of a 20
Database
Some mini-world relationships:
SECTIONs are of specific COURSEs
STUDENTs take SECTIONs
COURSEs have prerequisite COURSEs
INSTRUCTORs teach SECTIONs
COURSEs are offered by DEPARTMENTs
STUDENTs major in DEPARTMENTs
21
Example of a Database
Database
Database Approach
Database Approach
Database Approach
Data Abstraction:
A data model is used to hide storage details
and present the users with a conceptual view
of the database.
Programs refer to the data model constructs
rather than data storage details.
Image Source: https://www.hitechnectar.com/blogs/data-abstraction-level/
Characteristics of 26
Database Approach
Database Approach
Sharing of data and multi-user transaction
processing:
Allowing a set of concurrent users to retrieve from
and to update the database.
Concurrency control within the DBMS guarantees
that each transaction is correctly executed or
aborted
Recovery subsystem ensures each completed
transaction has its effect permanently recorded in
the database
OLTP (Online Transaction Processing) is a major
part of database applications. This allows hundreds
of concurrent transactions to execute per second.
Actors
Database Administrator
DB designers
End users
Casual end user
Naïve or parametric end user
Sophisticated end user
Standalone user
System Analysts and application programmers
Actors on the Scene 30
Database administrators:
Responsible for authorizing access to the
database, for coordinating and monitoring its
use, acquiring software and hardware
resources, controlling its use and monitoring
efficiency of operations.
Image Source: https://www.dataversity.net/so-you-want-to-be-a-database-administrator/
Actors on the Scene 31
Database Designers:
Responsible to define the content, the
structure, the constraints, and functions or
transactions against the database. They must
communicate with the end-users and
Image Source: https://www.cybertec-postgresql.com/en/services/postgresql-design/postgresql- understand their needs.
database-modeling/
Actors on the Scene 32
Sophisticated:
These include business analysts, scientists,
engineers, others thoroughly familiar with
the system capabilities.
Many use tools in the form of software
packages that work closely with the stored
Image Source: https://knowyourmeme.com/photos/1698903-computer-reaction-faces database.
Actors on the Scene 34
Stand-alone:
Mostly maintain personal databases using
ready-to-use packaged applications.
An example is a tax program user that creates its
own internal database.
Another example is a user that maintains an
Image Source: https://www.yourdictionary.com/stand-alone-pc address book.
Workers behind the scene
Those who work to maintain the database system environment
Scene
Scene
Database Approach
Database Approach
Database Approach
Database Approach
The Hierarchical Model creates hierarchical tree with parent/ child relationship, whereas the
Network Model has graph and links.
The relationship can be defined in the form of links and it handles many-to-many relations. This
itself states that a record can have more than one parent.
52
A Relational model groups data into one or more tables. These tables are related to each
other using common records.
The data is represented in the form of rows and columns i.e. tables.
54
Relational Data Model
Database Schema:
The description of a database.
Includes descriptions of the database structure, data types, and the
constraints on the database.
Schema Diagram:
An illustrative display of (most aspects of) a database schema.
Schema Construct:
A component of the schema or an object within the schema, e.g., STUDENT,
COURSE.
57
Database State:
The actual data stored in a database at a particular moment in time. This
includes the collection of all the data in the database.
Also called database instance (or occurrence or snapshot).
The term instance is also applied to individual database components, e.g.
record instance, table instance, entity instance.
59
Data Independence is defined as a property of DBMS that helps the user to change the
Database schema at one level of a database system without requiring to change the schema
at the next higher level.
Data independence helps the user to keep data separated from all programs that make use of
it.
Types of Data Independence
Physical Data Independence
Logical Data Independence
69
Physical Data Independence
Physical Data Independence : Changes internal schema without having to
change conceptual schema. i.e can easily change the physical storage structures
or devices with an effect on the conceptual schema.
It helps user to separate conceptual levels from the Internal/Physical levels.
It allows user to provide a logical description of the database without the need
to specify physical structures.
It is achieved by the presence of the internal level of the database and then the
transformation from the conceptual level of the database to the internal level.
70
Data definition language (DDL) - used by the DBA and by database designers to
define schemas
DDL compiler - processes DDL statements and stores the schema description in the DBMS
catalog
Data manipulation language (DML)– used for retrieval, insertion, deletion, and
modification of the data.
Procedural DMLs require a user to specify what data are needed and how to get those data.
Declarative DMLs (also referred to as nonprocedural DMLs) require a user to specify what
data are needed without specifying how to get those data.
Database Languages
Data Control Language (DCL) - used for granting and revoking user access
on a database
Grant: To grant access to user
Revoke: To revoke access from user
.
Transaction Control Language (TCL)– The changes in the database that we
made using DML commands are either performed or rollbacked using TCL
Commit: It is used to save the transaction on the database.
Rollback: It is used to restore the database to original since the last Commit.
DBMS
Stand-alone query language interfaces.
Interfaces 78
Storage Manager
provides the interface between the low-level data stored in the database and
the application programs/queries submitted to the system
translates the various DML statements into low-level file-system commands
responsible for storing, retrieving, and updating data in the database
DBMS Component Modules (contd..)
The storage manager components include:
Authorization and integrity manager
tests for integrity constraints and checks user’s access rights on data
Transaction manager
ensures the consistency of database despite system failures
ensures that the concurrent transaction executions proceed without conflicts
File manager
manages the allocation of storage space and the data structures used to represent information stored on
disk.
Buffer manager
fetching data from disk storage into main memory, and deciding what data to cache in main memory
The storage manager implements several data structures as part of the physical system implementation:
Data files, Data dictionary, Indices
DBMS Component Modules (contd..)
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 evaluation plan consisting of low-
level instructions that the query evaluation engine understands
also performs query optimization; that is, it picks the lowest cost evaluation plan from
among the alternatives
Query evaluation engine
executes low-level instructions generated by the DML compiler
Database Architecture
A client does not share any of its resources, but requests a server’s content or service function.
Clients therefore initiate communication sessions with servers which await incoming requests.
Examples of computer applications that use the client–server model are Email, network printing, and the
World Wide Web.
In this architecture, the database is directly accessed by the user(in which the client, server, and
Database all reside on the same machine).
Any changes will be performed over the database itself.
Used for development of the local application, where programmers can directly communicate with
the database for the quick response.
A simple one tier architecture example would be anytime you install a Database in your system
and access it to practice SQL queries
The 3-Tier architecture contains another layer between the client and server.
In this architecture, 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 system.
End user has no idea about the existence of the database beyond the application server and 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(Any large website on the internet, including
google.com).
Advantages :
Centralization – Access, Resources, and Data Security are controlled
through server.
Scalability – Any element can be upgraded when needed.
Flexibility – New Technology can be easily integrated into the system.
Interoperability – All components work together.
99
Disadvantages :
Dependability – When Servers goes down, operations will cease.
Lack of Mature Tools - To administrate.
Lack of Scalability – Network OS are not vary scalable.
Higher than anticipated Cost.
Network Congestion.
Classification of DBMS
Classification based on data model
Relational
Hierarchical
Network
Object oriented
XML