Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

2. DataBase Management System

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 42

DataBase Management System

Database Management System


(DBMS)
• A software system that enables users to
define, create, maintain, and control
access to the database.

• (Database) application program: a


computer program that interacts with
database by issuing an appropriate
request (SQL statement) to the DBMS.
Database Management System (DBMS)
What is DBMS?
A DBMS is a software that allows creation, definition and manipulation of database,
allowing users to store, process and analyse data easily. DBMS provides us with an
interface or a tool, to perform various operations like creating database, storing
data in it, updating data, creating tables in the database and a lot more.
Database management system is software that is used to manage the database.
DBMS also provides protection and security to the databases. It also maintains data
consistency in case of multiple users.
Here are some examples of popular DBMS used these days:
 MySql
 Oracle
 SQL Server
 IBM DB2
 PostgreSQL
 Amazon SimpleDB (cloud based) etc.
Database Management System (DBMS)
DBMS allows users the following tasks:
• Data Definition: It is used for creation, modification, and removal
of definition that defines the organization of data in the database.
• Data Updation: It is used for the insertion, modification, and
deletion of the actual data in the database.
• Data Retrieval: It is used to retrieve the data from the database
which can be used by applications for various purposes.
• User Administration: It is used for registering and monitoring
users, maintain data integrity, enforcing data security, dealing with
concurrency control, monitoring performance and recovering
information corrupted by unexpected failure.
Features of DBMS
1. Data storage, retrieval, and update: The ability to store, retrieve, and
update the data that are in the database.

2. User-accessible catalog: where descriptions of database components are


stored and are accessible to the users

3. Shared update support: A mechanism to ensure accuracy when several


users are updating the database at the same time

4. Backup and Recovery Services: Mechanisms for recovering the database


in the event that a database is damaged somehow.

5. Security Services: Mechanisms to ensure that certain rules are followed


with regard to data in the database and any changes that are made in the
data
Features of DBMS
6. Integrity services: Mechanisms to ensure that certain rules are followed
with regard to data in the database and any changes that are made in the
data.

7. Data Independence: Facilities to support the independence of programs


from the structure of the database.

8. Replication support: A facility to manage copies of the same data at


multiple locations.

9. Utility Services: DBMS provided services that assist in the general


maintenance of the database.
Features of DBMS
10. Data stored into Tables: Data is never directly stored into the database. Data is
stored into tables, created inside the database. DBMS also allows to have
relationships between tables which makes the data more meaningful and
connected. You can easily understand what type of data is stored where by looking
at all the tables created in a database.
11. Reduced Redundancy: In the modern world hard drives are very cheap, but earlier
when hard drives were too expensive, unnecessary repetition of data in database
was a big problem. But DBMS follows Normalisation which divides the data in such
a way that repetition is minimum.
12. Data Consistency: On Live data, i.e. data that is being continuosly updated and
added, maintaining the consistency of data can become a challenge. But DBMS
handles it all by itself.
13. Support Multiple user and Concurrent Access: DBMS allows multiple users to
work on it(update, insert, delete data) at the same time and still manages to
maintain the data consistency.
14. Query Language: DBMS provides users with a simple Query language, using which
data can be easily fetched, inserted, deleted and updated in a database.
15. DBMS supports transactions, which allows us to better handle and manage data
Advantages of DBMS
• Controls database redundancy: It can control data
redundancy because it stores all the data in one single
database file and that recorded data is placed in the database.
• Data sharing: In DBMS, the authorized users of an
organization can share the data among multiple users.
• Easily Maintenance: It can be easily maintainable due to the
centralized nature of the database system.
• Reduce time: It reduces development time and maintenance
need.
• Backup: It provides backup and recovery subsystems which
create automatic backup of data from hardware and software
failures and restores the data if required.
• multiple user interface: It provides different types of user
interfaces like graphical user interfaces, application program
interfaces
Disadvantages of DBMS
• Cost of Hardware and Software: It requires a high speed
of data processor and large memory size to run DBMS
software.
• Size: It occupies a large space of disks and large memory
to run them efficiently.
• Complexity: Database system creates additional
complexity and requirements.
• Higher impact of failure: Failure is highly impacted the
database because in most of the organization, all the data
stored in a single database and if the database is
damaged due to electric failure or database corruption
then the data may be lost forever.
Why Use a DBMS?

• Data independence and efficient access.


• Reduced application development time.
• Data integrity and security.
• Uniform data administration.
• Concurrent access, recovery from crashes.
Purpose of DBMS
1. Data redundancy and inconsistency
• Same information may be duplicated in several places.
• All copies may not be updated properly.
2. Difficulty in new program to carry out each new task
3. Data isolation
• Data in different formats.
• Difficult to write new application programs.
Purpose of DBMS …
Security problems
Every user of the system should be able to access only the data
they are permitted to see.
• E.g. payroll people only handle employee records, and cannot
see customer accounts; tellers only access account data and
cannot see payroll data.
• Difficult to enforce this with application programs.
Integrity problems
• Data may be required to satisfy constraints.
• E.g. no account balance below $25.00.
• Again, difficult to enforce or to change constraints with the
file-processing approach.
In the early days, database
applications were built directly on
top of file systems
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
Drawbacks of using file systems to store data (Cont.)
Atomicity of updates
 Failures may leave database in an inconsistent state with partial
updates carried out
 Example: Transfer of funds from one account to another should
either complete or not happen at all
Concurrent access by multiple users
 Concurrent access needed for performance
 Uncontrolled concurrent accesses can lead to inconsistencies
• Example: Two people reading a balance (say 100) and updating it by
withdrawing money (say 50 each) at the same time
Security problems
 Hard to provide user access to some, but not all, data

Database systems offer solutions to all the above problems


Advantages of DBMS over file system

1. Fast Data Access: The data response time increases in DBMS.

2. Minimized Data Redundancy: DBMS has different constraints


using them same data can't be stored in more than one
places.

3. Data Consistency: Since DBMS solves the problem of data


redundancy, the problem of data consistency is automatically
solved.
Advantages of DBMS over file system

4. No attributes for accessing the data: Here, we don't need to


know the location of the file. The user makes a request from
any web application or app and the server responds
accordingly.

5. Concurrent Access: Multiple users can access the database at


the same time when we are using the Database
Management System.

6. Security: We have role-based access control in DBMS. Each


user has a different set of access thus the data is secured
from problems like data leaks, misuse of data etc.
Applications of DBMS

1. Banking: all transactions.


2. Airlines: reservations, schedules.
3. Universities: registration, grades.
4. Sales: customers, products, purchases.
5. Manufacturing: production, inventory, orders, supply chain.
6. Human Resources: employee records, salaries, tax
deductions.
Components of DBMS Environment
DBMS Components: Hardware
When we say Hardware, we mean computer, hard disks, I/O channels
for data, and any other physical component involved before any data
is successfully stored into the memory.
The computer system(s) that the DBMS and the application programs
run on. This can range from a single PC, to a single mainframe, to a
network of computers.
When we run Oracle or MySQL on our personal computer, then our
computer's Hard Disk, our Keyboard using which we type in all the
commands, our computer's RAM, ROM all become a part of the
DBMS hardware.
DBMS Components: Software
The DBMS software and the application programs,
together with the operating system, including network
software if the DBMS is being used over a network.
This is the main component, as this is the program which
controls everything. The DBMS software is more like a
wrapper around the physical database, which provides us
with an easy-to-use interface to store, access and update
data.
The DBMS software is capable of understanding the
Database Access Language and intrepret it into actual
database commands to execute them on the DB.
DBMS Components: Data
The data acts as a bridge between the hardware and software
components and the human components. As we’ve already said, the
database contains both the operational data and the meta-data (the
‘data about data’).
Data is that resource, for which DBMS was designed. The motive
behind the creation of DBMS was to store and utilise data.
In a typical Database, the user saved Data is present and meta
data is stored.
Metadata is data about the data. This is information stored by the
DBMS to better understand the data stored in it.
For example: When I store my Name in a database, the DBMS will
store when the name was stored in the database, what is the size of
the name, is it stored as related data to some other data, or is it
independent, all this information is metadata.
DBMS Components: Procedures
Procedures refer to general instructions to use a database
management system. This includes procedures to setup
and install a DBMS, To login and logout of DBMS software,
to manage databases, to take backups, generating reports
etc.
The instructions and rules that govern the design and use
of the database. This may include instructions on how to
log on to the DBMS, make backup copies of the database,
and how to handle hardware or software failures.
People/Users
This includes the database designers, database administrators
(DBAs), application programmers, and the end-users.
Database Administrators: Database Administrator or DBA is the one who manages
the complete database management system. DBA takes care of the security of the
DBMS, it's availability, managing the license keys, managing user accounts and
access etc.
Application Programmer or Software Developer: This user group is involved in
developing and designing the parts of DBMS.
End User: These days all the modern applications, web or mobile, store user data.
How do you think they do it? Yes, applications are programmed in such a way that
they collect user data and store the data on DBMS systems running on their server.
End users are the one who store, retrieve, update and delete data.
DBMS Languages
Data Definition Language-DDL
• Data Definition Language (DDL) statements are used to
define the database structure or schema.
Some examples:
• CREATE - to create objects in the database
• ALTER - alters the structure of the database
• DROP - delete objects from the database
• TRUNCATE - remove all records from a table, including all
spaces allocated for the records are removed
• COMMENT - add comments to the data dictionary
• RENAME - rename an object
Data Manipulation Language (DML)

Data Manipulation Language (DML) statements are used for


managing data within schema objects.
Some examples:
• SELECT - Retrieve data from the a database
• INSERT - Insert data into a table
• UPDATE - Updates existing data within a table
• DELETE - deletes all records from a table, the space for the
records remain
• MERGE - UPSERT operation (insert or update)
• CALL - Call a PL/SQL or Java subprogram
• EXPLAIN PLAN - explain access path to data
• LOCK TABLE - control concurrency
Instances and Schemas
Similar to types and variables in programming languages
Schema:
The overall description of a database is called as Schema
Instance:
The collection of data stored in database at a particular
moment or time is called Instance
Schema/View of Data / Data Abstraction

Data Abstraction refers to the process of hiding irrelevant


details from the user.

There are mainly three levels of data abstraction. They are


1. Physical Level
2. Conceptual Level
3. View Level
Physical Level:
• Describes HOW data are actually stored
• It deals with the data structures used in physical
• It is otherwise called as Internal level
Logical Level:
• Describes WHAT data is stored in database and their relationships
among data
• This level is usually designed by using ER diagrams
• It is otherwise called as Conceptual Level, Schema level
External Level:
• Only part of the database can be viewed at a time but not the entire
database
• End user interaction with the database
• Database has many views
• It is otherwise called as Subschema level, View level
Data Independence
Modify the schema definition at any level without changing
the schema definition at any higher level.

We have two levels of data independence that are defined on


the basis of these three levels of abstraction.

1. Physical Data Independence


2. Logical Data Independence
Physical Data Independence

• It refers to the characteristic of changing the physical level


without affecting the logical level or conceptual level.

• Using this property we can easily change the storage


device of the database without affecting the logical schema.

Example:
• Suppose you want to replace the storage device form hard
disk to SSD or magnetic tape then it should not affect the
data stored at the logical level.
Logical Data Independence

• It refers to the characteristics of changing the logical level


without affecting the external or view level.
• This also helps in separating the logical level from the view
level.
• If we do any changes in the logical level then the user view
of the data remains unaffected.
• The changes in the logical level may include:
• Changing the data definition.
• Adding, deleting, or updating any new attribute, entity
or relationship in the database.
Database Users:

• Any person who uses the database and takes benefits from the
database is considered as Database User.

• They can be programmers, scientists, engineers, business


person or can be an employee.

• They are:
1. Database Administrators.
2. Database Designers.
3. System Analysts.
4. Application Programmers.
5. Sophisticated Users.
6. Naïve Users/Parametric Users.
7. Casual/Temporary Users
DBA stands for database administrator

He is responsible for managing the overall database


management system like a superuser of the system.

DBA is responsible for:


• Deciding the Instances for the Database.
• Defining the Schema.
• Granting of Authorization for data access.
• Managing Database Users and Security.
• Routine Maintenance.
• New Software Installation.
• Monitoring the database Server’s health and Tuning
accordingly.
Database Designers
• Database designers design the appropriate structure
for the database, where we share data.
System Analyst
• System analyst analyses the requirements of end-
users, especially naïve and parametric end users.
• They are responsible for the design, structure, and
properties of the database.
Application Programmers
• Application programmers are computer professionals,
who write application programs.
• They develop application programs such as C, C++,
Java, PHP, Python, etc. through which other user can
interact with the database.
Sophisticated Users
• Sophisticated users can be engineers, scientists,
business analysts, who are familiar with the database.
• These users interact with the database but they do not
write programs
Naïve Users / Parametric Users
• Naïve Users are Unsophisticated users, who have no
knowledge of the database.
• They are the end-users of the database who work
through the menu-driven applications.
• For Example: Railway’s ticket booking users are naive
users. Or Clerical staff in any bank is a naïve user.
Casual Users / Temporary Users
• These types of users communicate with the database
for a little period of time.
DBMS Architecture:
Types of DBMS Architecture
1-Tier Architecture

• In this, the database is directly available to the user. It


means the user can directly sit on the DBMS and uses it.
• Any changes done here will directly be done on the
database itself. It doesn't provide a handy tool for end
users.
• The 1-Tier architecture is used for development of the
local application, where programmers can directly
communicate with the database for the quick response.
2-Tier Architecture
• 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.
• To communicate with the DBMS, client-side application establishes a
connection with the server side.
3-Tier Architecture
• 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. 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.

You might also like