Chapter 5 - Database Management System
Chapter 5 - Database Management System
Management
System
Database Management System (DBMS)
• Database is a collection of data
• DBMS is a collection of inter-related data and set of programs
to store & access those data in an easy and effective manner.
File Processing System
• Files are used to store various documents.
• All files are grouped based on their categories.
• The file names are very related to each other and arranged
properly to easily access the files.
• If one needs to insert, delete, modify, store or update data, one
must know the entire hierarchy of the files.
DBMS vs File Processing System
• Centralized data for all software applications and department.
• No redundant data: Redundancy removed by data normalization. No
data duplication saves storage and improves access time.
• Data Consistency and Integrity: The root cause of data inconsistency
is data redundancy. Since data normalization takes care of the data
redundancy, data inconsistency also been taken care of as part of it
• Data Security: It is easier to apply access constraints in database
systems so that only authorized user is able to access the data. Each
user has a different set of access thus data is secured from the issues
such as identity theft, data leaks and misuse of data.
DBMS over File Processing System
• Privacy: Limited access means privacy of data.
• Easy access to data: Database systems manages data in such a way so
that the data is easily accessible with fast response times.
• Easy recovery: Since database systems keeps the backup of data, it is
easier to do a full recovery of data in case of a failure.
• Flexible: Database systems are more flexible than file processing
systems.
Types of DBMS Architecture
There are three types of DBMS architecture:
1. Single tier architecture
2. Two tier architecture
3. Three tier architecture
Single-tier Architecture
• The client, server, and database all reside
on the same machine
• Database is readily available on the client
machine
• Any request made by client doesn’t
require a network connection to perform
the action on the database.
• Rarely used in practice as your data is
prone to cyberattacks
Two-tier Architecture
• Similar to a basic client-server
model
• The database is present at the
server machine called the second
tier
• The DBMS application is present at
the client machine
• Presentation layer runs on a client
• The application at the client end
directly communicates with the
database at the server side
Two-tier Architecture
• The server is responsible for
providing query processing and
transaction management
functionalities
• Provides added security to the
DBMS as it is not exposed to the
end-user directly.
• Provides direct and faster
communication (vs 3-tier)
• Maintenance and understanding are
easier (vs 3-tier)
• Gives poor performance when there
are a large number of users
Three-tier Architecture
• Most popular client server architecture in DBMS
• Development and maintenance of functional processes, logic, data
access, data storage, and user interface is done independently as
separate modules
• Contains a presentation layer (client), an application layer (server), and
a data layer (database server)
Three-tier Architecture
• Application layer (server) is responsible for communicating the user’s
request to the DBMS system and send the response from the DBMS to
the user
• Application layer (server) also processes functional logic, constraint, and
rules before passing data to the user or down to the DBMS
Three-tier Architecture
• Data Integrity is maintained. Since there is a middle layer between the
client and the server, data corruption can be avoided/removed.
• Security is improved. This type of model prevents direct interaction of
the client with the server thereby reducing access to unauthorized data.
• Increased complexity of implementation and communication. It
becomes difficult for this sort of interaction to take place due to the
presence of middle layers.
Database Schema
• The skeleton structure that
represents the logical view
of the entire database.
• It defines how the data is
organized and how the
relations among them are
associated.
• It formulates all the
constraints that are to be
applied on the data.
Database Models
A database model shows the logical structure of a database,
including the relationships and constraints that determine how
data can be stored and accessed.
• Relational databases
• Hierarchical databases
• Network databases
• Object-oriented databases
Table/Relation
Relational
Table/Relation Database
Model
Relational Database Model
• Sorts data into tables (also called relations) consisting of
columns and rows
• Each column lists an attribute of the entity in question, such as
price, zip code, or birth date.
• The attributes in a relation are called a domain.
• A particular attribute or combination of attributes is chosen as a
primary key
• Each row, also called a tuple, includes data about a specific
instance of the entity in question, such as a particular employee.
• The model also accounts for the types of relationships between
those tables, including one-to-one, one-to-many, and many-to-
many relationships.
Hierarchical Database Model
• Resembles an upside-down tree
• Files are related in a parent-child manner
• Each parent capable of relating to more than one child
• But each child only being related to one parent.
Object-Oriented Database Model
• An object database is a system in which information is represented
in the form of objects as used in object-oriented programming
The DB-Engines Ranking ranks database management system according
to their popularity. The ranking is updated monthly.
DBMS Languages
User can access, update, delete, and store data or information in
the database using database languages. The following are
the databases languages in the database management system:
• Data Definition Language
• Data Manipulation Language
• Data Control Language
• Transaction Control Language
Data Definition Language (DDL)
DDL is used for defining the structure or schema of the database. It is
also used for creating tables, indexes, applying constraints, etc. in the
database.
• Create - create a new table or a new database.
• Alter - alter or change the structure of the database table.
• Drop - delete a table, index, or views from the database.
• Truncate - delete the records or data from the table, but its structure
remains as it is.
• Rename - rename an object from the database.
• Comment - used for adding comments to our table.
Data Manipulation Language (DML)
DML is a language used to access or manipulate the data in the
database. In simple words, this language is used to retrieve the data
from the database, insert new data into the database, and delete the
existing data from the database.
• Select - to retrieve or access the data from the database table.
• Insert - insert the records into the table.
• Update - change/update the existing data in a table.
• Delete - to delete one or all the existing records from the table.
Data Control Language (DCL)
DCL is used to access the stored or saved data. It is mainly used for
revoking and granting user access on a database.
• Grant - allows user’s access privileges to the database.
• Revoke - removes the accessibility of users from the database objects.
Transaction Control Languages (TCL)
TCL is a language which manages transactions within the database. It is
used to execute the changes made by the data manipulation language
(DML) statements.
• Commit - save the transactions in the database.
• Rollback - restore the database to that state which was last
committed.
Standard Query Language (SQL)
• SQL is a programming language that is typically used in
relational database or data stream management systems.
• It is both a data definition and a data manipulation language
• Language used in SAP Business One
Cardtype - Customer,
Supplier, etc.
Rules
• Customers with
account balance
greater than or
equal to 1,500
• C = Customer, S =
Supplier
SQL Query
Generator in
SAP Business
One
*BP = Business Partner
Coding Types
Coding Types