0% found this document useful (0 votes)
29 views65 pages

1 To 5 DBMS

Uploaded by

jagdishbca7a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views65 pages

1 To 5 DBMS

Uploaded by

jagdishbca7a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 65

Introduction To Database-1

❑Data - Raw facts that can be recorded or stored.


❑For E.g. Text, Numbers, Images, Videos etc.
❑Database - Collection of Related Data
❑For E.g. Collection of Text i.e. Student Data
❑Types of Database
✔ Multimedia Database
✔ Traditional Database
✔ Geographical Information System
✔ Real Time Database
❑Data Warehouse - Kind Of Database in which data is going to be
very huge and historical.
❑For E.g. Database for company of last 100 years
❑Database Management System- Set of Program(to define,
construct And Manipulate) to access the data is known as DBMS.
❑Database + Database management system = Database Systems
(DBS)
Introduction To Database
Management System-1
❑Database systems - Designed to manage large bodies of
information.
o It includes both defining structures for storage of information
and providing mechanisms for manipulation of information.
o It must ensures the safety of the information stored.
❑DBMS is set of programs to access data.
o A database management system (DBMS) is a collection of
programs that manages the database structure and controls access
to the data stored in the database.
o It also defines rules to validate and manipulate this data.
Role of DBMS -1
Role of DBMS -2
❑A database is a shared, integrated computer structure that stores a
collection of:
• End-user data—that is, raw facts of interest to the end user.
• Metadata, or data about data, through which the end-user data are
integrated and managed.
Database System Applications
❑Banking
❑Airline
❑Universities
❑Credit card transactions
❑Telecommunications
❑Finance
❑Sales
❑Online retailers
❑Manufacturing
❑Human resources etc.
Data processing versus Data
Management.
DATA PROCESSING:

Data processing refers to collection and manipulation of raw data, transforming its
structure to produce insightful and actionable information.
The primary objective is to extract valuable insights and uncover patterns hidden
within the data.
Various techniques and methods can be used to achieve this, including data filtering,
analysis and so on.
Filtering identifies parts of the data which may contain errors and removes them to
prevent any incorrect conclusions or derived products.
— Through analysis, useful information can be extracted from the data
Data Management
Data management is the practice of governing, organizing and controlling data.
Data are organized in a hierarchy that begins with the smallest piece of data
used by a computer—for purposes of this discussion, a single character such as a
letter or number.
Characters form fields such as names, telephone numbers, addresses, and
purchases. A collection of fields makes up a record.
A collection of records is referred to as a file.
Integrated and related files make up a database.
Introduction to File System
The file system is basically a way of arranging the files in a storage
medium like a hard disk.
The file system organizes the files and helps in the retrieval of files
when they are required.
File systems consist of different files which are grouped into
directories.
The directories further contain other folders and files.
The file system performs basic operations like management, file
naming, giving access rules, etc.
EG. NTFS, FAT
❑A field is a group of characters, numbers and/or symbols
❑A record is a group of related fields.
❑A file is a group of records.
❑Based on the group of records stored, the file type can be classified
as:
oMaster Files – Permanent entities information
oTransaction Files – Day 2 Day Activities or transactions
oReport File – Extracting transaction and master information
❑Files can be organized in different ways based
on its access method.
❑File can be organized,
◦ Sequentially –Data Stored Sequentially
◦ Direct Access Manner – Data is in scattered manner
in random order
Disadvantages of File Systems /
Purpose of DBMS
❑Data redundancy and inconsistency
❑Difficulty in accessing data
❑Data isolation
❑Integrity problems
❑Atomicity problems
❑Concurrent access anomalies
❑Security problems
What is a Relational Database
Management System (RDBMS)?
❑A relational database management system (RDBMS) is a program that allows you to create, update, and
administer a relational database.
❑ Most relational database management systems use the SQL language to access the database.
❑RDBMS stands for Relational Database Management Systems..
❑All modern database management systems like SQL, MS SQL Server, IBM DB2, ORACLE, My-SQL and Microsoft
Access are based on RDBMS.

❑It is called Relational Data Base Management System (RDBMS) because it is based on relational model
introduced by E.F. Codd.

❑How it works
❑Data is represented in terms of tuples (rows) in RDBMS.
❑Relational database is most commonly used database. It contains number of tables and each table has its own
primary key.

❑Due to a collection of organized set of tables, data can be accessed easily in RDBMS.
What is SQL?
SQL (Structured Query Language) is a programming
language used to communicate with data stored in
a relational database management system.
SQL syntax is similar to the English language, which
makes it relatively easy to write, read, and
interpret.
Popular Relational Database
Management Systems
MySQL
MySQL is the most popular open source SQL database.
It is typically used for web application development, and often accessed using PHP.
The main advantages of MySQL are that it is easy to use, inexpensive, reliable (has been around
since 1995), and has a large community of developers who can help answer questions.
PostgreSQL
PostgreSQL is an open source SQL database that is not controlled by any corporation. It is
typically used for web application development.
PostgreSQL shares many of the same advantages of MySQL. It is easy to use, inexpensive,
reliable and has a large community of developers. It also provides some additional features such
as foreign key support without requiring complex configuration.
Oracle DB
Oracle Corporation owns Oracle Database, and the code is not open sourced.
Oracle DB is for large applications, particularly in the banking industry.
Most of the world’s top banks run Oracle applications because Oracle offers a powerful combination
of technology and comprehensive, pre-integrated business applications, including essential
functionality built specifically for banks.
SQL Server
Microsoft owns SQL Server. Like Oracle DB, the code is close sourced.
Large enterprise applications mostly use SQL Server.
Microsoft offers a free entry-level version called Express but can become very expensive as you scale
your application.
SQLite
SQLite is a popular open source SQL database.
It can store an entire database in a single file.
One of the most significant advantages this provides is that all of the data can be stored locally
without having to connect your database to a server.
Difference between DBMS and RDBMS
Disadvantages of File Processing
Systems / Purpose of DBMS - 1
❑Data redundancy and inconsistency:-
◦ Different programmers create the files, the various files are likely to
have different format.
◦ The same information may be duplicated in several files. E.g. address
and telephone no of particular customer may appear in file that
consist of saving account records and in file that consist of checking
account records.
◦ It leads to higher storage.
◦ It may also lead to inconsistency i.e. various copies of the same data
may no longer agree. E.g. a changed customer address may be
reflected in saving account records but not elsewhere in the system
❑Difficulty in accessing data:-
◦ E.g. bank officer needs to find out names of all customers
who live within a particular postal code area.
◦ Because the designer of the system did not anticipate this
request, there is no application program on hand. But there
is an application program to generate list of all customers.
◦ There are two choices before officer: obtain list of all
customer and extract information manually or ask the
system programmer to write necessary application program.
❑Data isolation:-
oBecause data are scattered in various files , and files may be in
different format, writing new application programs to retrieve the
appropriate data is difficult. Files with different format get isolated.
❑Integrity problems:-
oConstraints are not provided. E.g. if -10 is entered in balance field ,
it will not be recognized as wrong amount by file system.
oIntegrity of database means correctness of data stored in the
database.
❑Atomicity problems:-
◦ In many applications, it is crucial that, if a failure occurs, the data to
be restored to the consistent state that existed prior to the failure.
The transaction must happen in its entirety or not at all. It is
difficult to ensure this in file processing e.g. transfer of money from
one account to another account.
◦ E.g. program of transferring Rs. 500 from account A to account B. If a
system failures occurs during the execution of the program, it is
possible that the Rs. 500 was removed from account A but was not
credited to account B, resulting in an inconsistent database state.
(either both (debit/ credit) or none should occur)
❑Concurrent access anomalies:-
◦ Many systems allow multiple users to update the data
simultaneously. System must maintain some form of
supervision for this. But it is very difficult to implement using
file processing system. problems of read- write operation.
◦ E.g. consider bank account A, containing Rs.500. If two
customers withdraw funds (Rs.50 and Rs.100 respectively) at
about same time, the result of concurrent executions may
leave the account in an incorrect state.
❑Security problems :-
◦ Every user of the database system should not be able to
access all the data. It is very difficult to enforce such
security problem in file processing system
Advantages of DBMS
✔Improved data sharing
✔ Improved data security
✔ Better data integration
✔ Minimized data inconsistency
✔ Improved data access
✔ Improved decision making
✔ Increased end-user productivity
DBMS Functions
❑Data dictionary management
❑Data storage management
❑Data transformation and presentation
❑Security management
❑Multiuser access control
❑Backup and recovery management
❑Data integrity management
❑Database access languages and application -
programming interfaces
❑Database communication interfaces
Data Abstractions-1
❑Database systems are made-up of complex data structures.
❑To easy the user interaction with database, the developers hide internal
irrelevant details from users
❑It is a process of easy user interface to users by hiding underlying
complexities of data management from users.
❑It defines views; which user can view which part.
❑Database system provides users with abstract view of the data.
❑It only shows a part of database that a user needs. The three-level
architecture aims to separate each user’s view of the database from the
way the database is physically represented
Views Of Data/Data Abstraction/ANSI Sparc Architecture

View level View 1 View 2 View N

Conceptual
level Logical level

Physical level
Internal level

Stored
database
HDD
❑PHYSICAL LEVEL
oIt is the lowest level of abstractions and describes how the
data are stored on the storage disk and access mechanisms to
retrieve the data.
oDBMS developer is concerned with this level.
oThis level emphasis on minimizing the number of disks access
so that data can be retrieved very fast.
oIt describes complex low-level data structures in detail.
oExample: we are storing customer information in a customer table.
oAt physical level these records can be described as blocks of storage
(bytes, gigabytes, terabytes etc.) in memory. These details are often hidden
from the programmers.
oAt the internal level, the database is represented physically on the
computer. It emphasizes the physical implementation of the database to
do storage space utilization and to achieve the optimal runtime
performance, and data encryption techniques. It interfaces with the
operating system to place the data on storage files and build the storage
space, retrieve the data, etc.
❑LOGICAL LEVEL
oThis level describes what data are stored in the database and
the relationships between the data.
oIt describes stored data in terms of the data model.
oIt describes the database in terms of small number of
relatively simple structures.
❑LOGICAL LEVEL
oExample: At the logical level customer records can be described as fields
and attributes along with their data types, their relationship among each
other can be logically implemented.
oThe programmers generally work at this level because they are aware of
such things about database systems..
oThis level contains the logical structure of the entire database, it
represents the complete view of the database that the organization
demands independent of any storage consideration
❑VIEW LEVEL
oEvery user don’t need to access all information stored in the database.
oThis level is basically concerned with dividing the database according to
the need of the database users.
oIt simplifies the interaction of the users with the system.
oExample: At view level, user just interact with system with the help of GUI and
enter the details at the screen, they are not aware of how the data is stored and
what data is stored; such details are hidden from them.
❑VIEW LEVEL
oThe data of the database that is relevant to that user is described at this
level.
oThe different views may have different ways of representing the same
data. For example, one user may view name in the form (firstname,
lastname), while another may view as (lastname, firstname).
Data Model
❑The basic design or the structure of the database is the data
model.
❑It is a collection of conceptual tools for describing data, data
relationships, data semantics, and consistency constraints.
❑The basic structure of the database that organizes data,
defines how the data are stored and accessed, and the
relationships between the data, is the data model.
Types of database models
oHierarchical Model
oNetwork Model
oEntity-Relationship(E-R) Model
oRelational Model
oObject-Oriented Model
oObject-Relational Model
Relational Model
❑It is a lower level model that uses a collection of tables to
represent both data and relationships among those data.
❑Each table has multiple columns, depending on the number
of attributes, and each column has a unique name.
Student
sid sname Standard
A-101 Ramesh 11
A-102 Kriti 10
A-103 Laxmi 12
E-R Model
❑It is a high level model based on the need of the
organization.
❑Its entities are distinguishable from other objects and
relationship is an association among several entities.
Student Books
Borrows

sid sname standard bid author


Instances and Schemas
❑Instance: The collection of information stored in a database at a particular moment is called instance of a
database.

❑Database change over time as information is inserted or deleted.


❑Schema: The overall structure/design of database is called the database schema.
❑DB have several schema partitioning according to levels of abstraction. At lowest level is Physical schema; at
immediate level Logical schema and at highest level subschema

❑DB System support one logical ,physical and several subschemas.


Data Independence
❑ The ability to modify a schema definition in one level without affecting a schema definition in the next level is
called Data Independence.

1. Physical Data Independence: is the ability to modify the physical schema without causing application
program to be rewritten for improvement in performance.

2. Logical Data Independence: is the ability to modify the logical schema without causing application program
to be rewritten for logical structure of database is altered. (For eg. If new type of account added in banking
system).
Database Languages (DDL, DML)
❑Data Definition Language(DDL): Specify DB Schema
◦ Database language that is used to create, delete or modify database schema/objects is called DDL.
◦ It is used by Database Administrators(DBA) to specify the conceptual schema.
◦ DDL interpreter converts DDL statements into equivalent low level statements understood by the DBMS.
◦ Normally, create, alter, and drop statements are DDL statements.
◦ DDL statements make changes in the schema
Example: For create command
create table Student Example: For drop command
drop Student;
(
sid char(4),
sname varchar(50), Example: For alter command
alter table Student
standard integer ADD COLUMN address varchar(20);
);
❑Data manipulation Language(DML): express DB query in instance
oDatabase language that enables insert, update, delete, and retrieval of data from the database is
called Data Manipulation Language.

oDML complier converts DML statements into equivalent low level statements that the database
understands.

oNormally, insert, update, delete, select are DML commands.


oDML reflects change in the instance, not the schema
Example: For insert Example: for update Example: for select
Insert into Student Update Student Select *
values(“A-101”, Set class = 11 From Student
“Ramesh”, 12); Where sid = “A-101”
; Example: For delete
Delete from standard
Where sname = “Kriti”

Note: In SQL, cases are insensitive. So, instead of Student one can write
StUdEnT as well.
Also, for integer values “12” is incorrect but 12 is correct.
And, for char and varchar “Kriti” is correct and Kriti is incorrect.
Database users and administrators
❑Users are distinguished by the way they interact with the
database system.
1. Naive users:
◦ They interact with the system by invoking one of the application
programs written previously. Naive users are bank teller,
receptionist, etc.
◦ For e.g., bank teller needs to add Rs.90 to account Ram, and
deduct the same amount from account Sita. Then the
application program the bank teller uses is transfer.
2. Application programmers:
oThey are specializes computer professionals who write the application
programs for naive users. Eg. Banking system program.
3. Sophisticated users:
oThey make request to the database with the help of query languages without
writing the program.
4. Specialized users:(DBA)
oThey are experts who write database application like system storing complex
data types, CAD systems that do not fit to the traditional data-processing
framework.
❑Database administrator:
DBA is a person who has central control over data and the
associated application programs.
He/she is the one who can define schema, install new software,
enforcing security to the system, etc.
Functions of DBA
1. Schema definition. The DBA creates the original database schema by
executing a set of data definition statements.
2. Storage structure and access-method definition
3. Schema and physical-organization modification. The DBA carries out
changes to the schema and physical organization to reflect the changing
needs of the organization
4. 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.
5. Routine maintenance. Examples of the database administrator’s routine maintenance
activities are:
◦ Periodically backing up the database, either onto tapes or onto remote servers, to prevent
loss of data in case of disasters such as flooding.
◦ Ensuring that enough free disk space is available for normal operations, and upgrading disk
space as required.
◦ Monitoring jobs running on the database and ensuring that performance is not degraded by
very expensive tasks submitted by some users
Transaction Management
❑Collection of operations that form a single logical unit of work
are called transaction.
❑Transaction management ensures that the database system
have ACID properties.

A = atomicity
C = consistency
I = isolation
D = durability
1. Atomicity:
Atomic means whole. This property ensures that the changes
made to the database are wholly reflected or no change is
made. But partial changes or execution are not made.
2. Consistency:
The database must move from one consistent state to another
after the execution of the transaction. Transaction do not
violate any DB constraints. The execution of two programs one
after another will preserve consistency.
3. Isolation:
Even if many transaction may be done at the same time but
isolation ensures that if transaction A and B are executing
concurrently, then either A must execute first then B is
executed or, B must execute first then A is executed.
4. Durability:
Changes made to the database are permanent and even if
the system failure occurs, that don’t lead to the erase of the
transaction executed previously.
Database Structure/Database
Architecture
❑A database system is partitioned into modules that
deal with each of the responsibilities of overall
system.
❑Some functions are provided by underlying
operating system.
Functional Components of Database
System
❑Storage Management
❑Query Processor
Storage Manager
❑It provides interface between the low level
data stored in the database and the application
programs and queries submitted to the system.
Components of Storage Manager
⮚Authorization and Integrity Manager: tests
integrity constraints and checks the authority of
users to access
⮚Transaction Manager: Makes sure that the
database remains in consistent state despite
system failures and concurrent conflicting
transactions
Components of Storage Manager
⮚File Manager: Manages allocation of space on
disk storage and data structure used to
represent information stored on disk.
⮚Buffer Manager: Responsible for fetching data
from disk storage into main memory and
deciding which data to cache in memory.
Query Processor
❑Responsible for execution of database queries
Components of Query Processor
⮚DML Compiler: Translates DML statements from
query language to low level operations that query
evaluation engine can understand. In addition, it finds
good strategy for executing the query.
⮚Embedded DML Compiler: Converts DML
statement embedded in application program code to
normal procedure calls in host language. It must
interact with the DML compiler to generate the
appropriate code.
Components of Query Processor
⮚DDL Interpreter: Interprets DDL statements
and record them in a set of tables containing
metadata (data dictionary).

⮚Query Evaluation Engine: Executes low level


operations generated by DML compiler
Parts of Physical System
❑Data files: store the database itself.
❑Data dictionary: stores metadata about
structure of database.
❑Indices: provides fast access to data items that
hold particular values
❑Statistical data: stores statistical data about
database which is used by query engine.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy