Unit 1
Unit 1
Management
System(DBMS)
🠶 Unit 1:Introduction to DBMS,Data
Models
► Ex:25,Suman,Hyderabad
► Ex: Flipkart,Ola,Youtube
Data Information
Input for computer system Output of data
Users
Database
Apps
USERS
🠶 A typical DBMS has users with different rights and
permissions who use it for different purposes.
🠶 End Users − End users are those who actually reap the benefits
of having a DBMS.
ADVANTAGES OF DBMS
🠶 Data Independence
🠶 Reducing Data Redundancy
🠶 Sharing of Data
🠶 Efficient data access
🠶 Data integrity
🠶 Concurrent access
🠶 Data Security
🠶 Privacy
🠶 Backup & Recovery
🠶 Data Consistency
Examples of DBMS
🠶 IBM DB2
🠶 Microsoft Access
🠶 Mongo DB
🠶 Microsoft SQL Server
🠶 MySQL
🠶 Oracle RDBMS
🠶 Sybase
🠶 Informix
🠶 Postgres
DBMS Applications
Database Applications:
Banking: transactions
Airlines: reservations, schedules
Universities: registration, grades
Sales: customers, products, purchases
Online retailers: order tracking, customized recommendations
Manufacturing: production, inventory, orders, supply chain
Human resources: employee records, salaries, tax deductions
Databases can be very large.
Databases touch all aspects of our lives
Disadvantages of DBMS
You can grant a certain type of permission using this line of code,
such as full or partial access to the resources in a specific data table.
2) REVOKE Statement
The REVOKE clause is used to revoke database user permissions and
privileges.Their syntax, however, is identical:
Syntax : REVOKE type_of_permission ON database_name.table_name FROM
username'@'localhost‘
1. An entire program
2. A portion of a program
3. A single command
EXAMPLES OF A TRANSACTION
4. Updating a Record
5. Locate the Record on Disk
6. Bring record into Buffer
7. Update Data in the Buffer
8. Writing Data Back to Disk
Consider the following example of transaction
operations to be performed to withdraw cash from
an ATM vestibule.
Steps for ATM Transaction
1. Transaction Start.
2. Insert your ATM card.
3. Select a language for your transaction.
4. Select the Savings Account option.
5. Enter the amount you want to withdraw.
6. Enter your secret pin.
7. Wait for some time for processing.
8. Collect your Cash.
9. Transaction Completed.
All instructions before committing come under a partially committed
state and are stored in RAM. When the commit is read the data is
fully accepted and is stored on a Hard Disk.
If the transaction is failed anywhere before committing we have to go
back and start from the beginning. We can’t continue from the same
state. This is known as Roll Back.
A transaction can include the following basic database access operation.
Read/Access data (R): Accessing the database item from disk (where the database stored
data) to memory variable.
Write/Change data (W): Write the data item from the memory variable to the disk.
Commit: Commit is a transaction control language that is used to permanently save the
changes done in a transaction
Example: Transfer of 50₹ from Account A to Account B. Initially A= 500₹, B= 800₹.
Properties of
transaction
Atomicity. Either all operations of the transaction are properly
reflected in the database or none are.
Consistency. Execution of a transaction in isolation preserves
the consistency of the database.
Isolation. Although multiple transactions may execute
concurrently, each transaction must be unaware of other
concurrently executing transactions. Intermediate transaction
results must be hidden from other concurrently executed
transactions.
• That is, for every pair of transactions Ti and Tj, it appears to
Ti that either Tj, finished execution before Ti started, or Tj
started execution after Ti finished.
Durability. After a transaction completes successfully, the
changes it has made to the database persist, even if there are
system failures.
Desirable Properties of Transaction
(ACID Properties)
For a transaction to be performed in DBMS, it must possess several properties
often called ACID properties.
• A – Atomicity
• C – Consistency
• I – Isolation
• D – Durability
DBMS STRUCTURE
Query processor:
It consists of DDL(Data Definition Language) interpreter, DML(Data
Manipulation Language) compiler and query evaluation engine.
The following are various functionalities and components of query processor
• DDL interpreter: This is basically a translator which interprets the DDL
statements in data dictionaries.
• DML compiler: It translates DML statements query language into an
evaluation plan. This plan consists of the instructions which query
evaluation engine understands.
• Query evaluation engine: It executes the low-level instructions
generated by the DML compiler.
When a user issues a query, the parsed query is presented to a query
optimizer, which uses information about how the data is stored to produce
an efficient execution plan for evaluating the query. An execution plan is a
blueprint for evaluating a query. It is evaluated by query evaluation engine.
Storage manager:
Storage manager is the component of database system that provides
interface between the low level data stored in the database and the
application programs and queries submitted to the system.
The storage manager is responsible for storing, retrieving, and updating
data in the database. The storage manager components include
• Authorization and integrity manager: Validates the users who
want to access the data and tests for integrity constraints.
• Transaction manager: Ensures that the database remains in
consistent despite of system failures and concurrent transaction
execution proceeds without conflicting.
• File manager: Manages allocation of space on disk storage and
representation of the information on disk.
• Buffer manager: Manages the fetching of data from disk storage
into main memory. The buffer manager also decides what data to
cache in main memory. Buffer manager is a crucial part of database
system.
Disk Storage
Example:
1. Hierarchical Model
2. Network Model
3. Entity-relationship Model
4. Relational Model
5. Object-Oriented(OO) Model
Hierarchical
model
The hierarchical model classifies the data into a tree-like
structure with a single parent or root for each record. Sibling
records are arranged in a certain sequence. This is the physical
order in which the database is stored. This model is useful for
explaining a wide range of real-world interactions.
Database Management
It depicts a set of 1:M relationships between a parent and its children
segments
Dr. Jay Sarraf, School of Computer Engineering, KIIT Deemed to be
Hierarchical
model
Advantages of Hierarchical
Model
• It is very simple and fast to traverse through a tree-
like
structure.
Database Management
• Any change in the parent node is automatically
reflected in the child node so, the integrity of data
is maintained.
Disadvantages of Hierarchical
Model
• Complex relationships are not supported.
Advantages of Network
Model
• When compared to the hierarchical approach, data may be obtained
more quickly. This is because the data in the network model is more
linked and there may be more than one path to a certain node. As a
Database Management
result, the information may be accessed in a variety of ways.
Disadvantages of Network
Model
• As additional relationships are added, the system may get
increasingly complicated. To operate with the model, a user needs
have full understanding of it.
Database Management
comprehend the system. The ER diagram is a visual tool used to
depict an ER Model. The ER diagram is made up of three parts:
Database Management
database designers for communicating their ideas.
• Easy Conversion to any Model : This model maps well to the relational
model and can be easily converted relational model by converting
the ER model to the table. This model can also be converted to any
other model like network model, hierarchical model etc.
The most common model is the Relational Model. The data in this
model is kept in the form of a two-dimensional table. All data is
saved in the form of rows and columns. Tables are the foundation
of a relational paradigm. In the relational paradigm, the tables are
Database Management
also referred to as relations. Example: We have an Employee
table in this example.
Database Management
many rows and columns we want.
• Bad Design: As the relational model is very easy to design and use.
So the users don't need to know how the data is stored in order to
access it. This ease of design can lead to the development of a poor
database which would slow down if the database grows.
Database Management
a relational database.
• Any object in a hypertext database can link to any other object. It is effective
for organizing a large amount of heterogeneous data, but it is not perfect for
numerical analysis.
OODs are most often used with object-oriented programming languages like Java, Kotlin, C#, Node JS
(React), and Swift.
Dr. Jay Sarraf, School of Computer Engineering, KIIT Deemed to be
Object-Oriented(OO)
Model
Advantages of Object Oriented Data
Model
• Complex data sets can be saved and retrieved quickly and easily.
Database Management
• Semantic content is added
•It is a 3–level/schema
architecture.
We have namely two levels of data independence arising from these levels of
abstraction:
• Physical level data independence
• Logical level data independence
Logical Data Independence: