0% found this document useful (0 votes)
18 views20 pages

01 01 Introduction

The document provides an overview of database management systems (DBMS) and relational database management systems (RDBMS), highlighting their definitions, characteristics, advantages, and disadvantages. It covers the history of database technologies, types of databases including SQL and NoSQL, and the ACID properties that ensure data integrity. Additionally, it discusses deadlock scenarios in DBMS and Codd's 12 rules that define a true relational database system.

Uploaded by

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

01 01 Introduction

The document provides an overview of database management systems (DBMS) and relational database management systems (RDBMS), highlighting their definitions, characteristics, advantages, and disadvantages. It covers the history of database technologies, types of databases including SQL and NoSQL, and the ACID properties that ensure data integrity. Additionally, it discusses deadlock scenarios in DBMS and Codd's 12 rules that define a true relational database system.

Uploaded by

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

Introduction

1. DBMS
2. RDBMS
3. History
4. Types
5. Dbms vs Rdbms

case sensitive.
Case sensitive uppercase or lowercase dogha chalel.

Database Technologies
File
Collection of data on secondary storage device
File=data+Information
4 session: Boot block, Super Block, i-Node list, Data blocks

What is Database
The database is a collection data which is used to retrieve, insert and delete the
data.
A database is an application that stores collection of records.
It allows us to organize data into tables, rows, columns, and indexes to find
information very quickly.

Database Management System(DBMS)


 It is software which is used to manage the database.
 For example: MySQL, Oracle, Sybase, MongoDB, Informix, PostgreSQL, SQL
Server
 provides protection and security
 Modern databases are managed by the database management system (DBMS)
 Crud Operations
o Create : Insert new record
o Retrieve : Select Existing record
o Update : Modify Existing record
o Delete : Delete existing record

 A cylindrical structure is used to display the image of a database.

Both (DBMS) and (RDBMS) can follow the ACID properties, but it's essential to
understand the distinction between the two terms.
 DBMS:
A DBMS is a software application that provides an interface for interacting with
databases.
It facilitates the creation, maintenance, and retrieval of data from a database.
Not all DBMS systems follow full set of ACID properties,
 RDBMS:
An RDBMS is a type of DBMS that is specifically designed to manage relational
databases.
A relational database organizes data into tables (relations) with predefined
schema, and it enforces relationships between tables.
RDBMS full follows ACID.

Characteristics of DBMS (ACID properties)


A means Atomicity: This ensures the data operation will complete either success
or failure. It follows the 'all or nothing' strategy. For example, a transaction will
either be committed or abort.
C means Consistency: If we perform any operation over the data, its value before
and after the operation should be preserved OR (ensures that a database remains in a
valid state before and after a transaction.)

For example, the account balance before and after the transaction should be correct,
i.e., it should remain conserved.

I means Isolation ensures that concurrent transactions do not interfere with each
other.

For example, when multiple transactions occur at the same time, one transaction
effects should not be visible to the other transactions in the database.

D means Durability: It ensures that once it completes the operation and commits
the data, data changes should remain permanent.

o guarantees that once a transaction is confirmed as successful, its effects on the


database will persist(a process or database that will still exist after poweroff),
even in the face of system failures (e.g., power outage, hardware failure).

Advantages of DBMS
o Controls database redundancy(storing data in two or more places within a
database):
It stores all the data in one single database file and that recorded data is
placed in the database.
o Data sharing
o Easily Maintenance
o Reduce time
o Backup: It provides backup and recovery subsystems which create automatic
backup of data from hardware and software failures and restores the data if
required.
o multiple user interface: It provides different types of user interfaces like
graphical user interfaces, application program interfaces
Disadvantages of DBMS
o Cost of Hardware and Software
o Size
o Complexity
o 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.

History
 1968 File-Based database were introduced data was maintained in a flat file.
Require Prog lang like COBOL, BASIC.

Hierarchical Data Model


 1968-1980 was the era of the Hierarchical Database.
 IBM's(Information Management System) first DBMS.
 files are related in a parent/child manner.

RDBMS
 1970 It is the era of RDBMS, proposed by E.F. Codd.
 From 1970 to 1972, E.F. Codd published a paper to propose using a relational
database model.

RDBMS (Relational Database Management System)


 RDBMS is a type of DBMS that is specifically designed to manage relational
databases.
 All modern database like SQL, MS SQL Server, IBM DB2, ORACLE, My-SQL, and
Microsoft Access are based on RDBMS.
 introduced by E.F. Codd.
 two main terminologies called instance and schema.
o instance is a table with rows or columns
o Schema specifies the structure like name of the relation, type of each column
and name.
 This model uses some mathematical concept like set theory and predicate logic.
 Data is represented in terms of tuples (rows) in RDBMS.
 each table has its primary key.

Table->
 Row/Record/Tuples
 Column/Fields/Attributes

Types of Databases
Relational Database(SQL,MySQL, Oracle)
 The data is stored in structured format.
 The data is store in table format-> rows(tuple) and columns(attributes)
 It also allows to stores relations between table, hence it is called RDBMS
 It is secure.
 A relational database uses SQL for storing, manipulating, as well as maintaining
the data. E.F. Codd invented the database in 1970.
 Each table in the database carries a key that makes the data unique from others.
 Examples MySQL, Microsoft SQL Server, Oracle, etc.

NoSQL ->MongoDB, Cassandra, Couchbase DB, firebase


 It is unstructured database.
 Stores data in json (javascript object notation) format
 Less secure than SQL.
 eg. MongoDB, Cassandra, CouthbaseDB
 Non-SQL/Not Only SQL is a type of database that is used for storing a wide
range of data sets.
 It is not a relational database as it stores data not only in tabular form but in
several different ways.

NoSQL four types:

1. Key-value storage: It is the simplest type of database storage where it stores every
single item as a key (or attribute name) holding its value, together.
2. Document-oriented Database: A type of database used to store data as JSON-like
document. It helps developers in storing data by using the same document-model format
as used in the application code.
3. Graph Databases: It is used for storing vast amounts of data in a graph-like
structure. Most commonly, social networking websites use the graph database.
4. Wide-column stores: It is similar to the data represented in relational databases. Here,
data is stored in large columns together, instead of storing in rows.

Advantages of NoSQL Database


o It enables good productivity in the application development as it is not required to store
data in a structured format.
o better option for managing and handling large data sets.
o high scalability(can handle a large increase in users).
o Users can quickly access data from the database through key-value.

5) Cloud Database
A type of database where data is stored in a virtual environment and executes over
the cloud computing platform.
It provides users with various cloud computing services (SaaS, PaaS, IaaS, etc.) for
accessing the database. There are numerous cloud platforms, but the best options
are:
o Amazon Web Services(AWS)
o Microsoft Azure
o Kamatera
o PhonixNAP
o ScienceSoft
o Google Cloud SQL, etc.

Hierarchical Databases
It is the type of database that stores data in the form of parent-children relationship
nodes. Here, it organizes data in a tree-like structure.

 Data get stored in the form of records that are connected via links.

 Each child record in the tree will contain only one parent.

 On the other hand, each parent record can have multiple child records.

GraphDB Network Databases (Neo4j) It shows data in graph format


follows the network data model.
Useful when you want to show data in network form.
Here, the representation of data is in the form of nodes connected via links between
them. Unlike the hierarchical database, it allows each record to have multiple children
and parent nodes to form a generalized graph structure.

Memory Database-→ MemDB, VoltDB The data is stored in RAM; hence size of
data is very small, but very fast to access
 Usually used by researchers
DBMS RDBMS

data is store as a file as a table(tabular)

useful for small amount (mb). huge data (GB).


DBMS is meant to be for small RDBMS is designed to handle large amount
organization and deal with small of data. it supports multiple users.
data. it supports single user.

no relation between data inter relation between data

data is generally stored in either a the tables have primary key and the data
hierarchical form or a navigational are stored in the form of tables.
form.

no Normalization Normalization is present

DBMS does not apply any RDBMS defines the integrity constraint for
security with regards to data the purpose of ACID (Atomocity, Consistency,
manipulation. Isolation and Durability) property.

not support distributed supports distributed database.


database.

heavy programming Crud Operations

Client side processing Server side processing

Slower faster

no security secure

eg. Xml, MS Access etc. eg.SQL, mysql, oracle, postgre, sql


server, IBM

Deadlock in DBMS
A deadlock is a condition where two or more transactions are waiting indefinitely for
one another to give up locks. Deadlock is said to be one of the most feared
complications in DBMS as no task ever gets finished and is in waiting state forever.

For example: In the student table, transaction T1 holds a lock on some rows and needs
to update some rows in the grade table. Simultaneously, transaction T2 holds locks on
some rows in the grade table and needs to update the rows in the Student table held
by Transaction T1.
Now, the main problem arises. Now Transaction T1 is waiting for T2 to release its lock
and similarly, transaction T2 is waiting for T1 to release its lock. All activities come to
a halt state and remain at a standstill. It will remain in a standstill until the DBMS
detects the deadlock and aborts one of the transactions.

Deadlock Avoidance
o When a database is stuck in a deadlock state, then it is better to avoid the database
rather than aborting or restating the database. This is a waste of time and resource.
o Deadlock avoidance mechanism is used to detect any deadlock situation in advance. A
method like "wait for graph" is used for detecting the deadlock situation but this
method is suitable only for the smaller database. For the larger database, deadlock
prevention method can be used.

Deadlock Detection
In a database, when a transaction waits indefinitely to obtain a lock, then the DBMS
should detect whether the transaction is involved in a deadlock or not. The lock
manager maintains a Wait for the graph to detect the deadlock cycle in the database.

Wait for Graph


o This is the suitable method for deadlock detection. In this method, a graph is created
based on the transaction and their lock. If the created graph has a cycle or closed loop,
then there is a deadlock.
o The wait for the graph is maintained by the system for every transaction which is
waiting for some data held by the others. The system keeps checking the graph if there
is any cycle in the graph.

The wait for a graph for the above scenario is shown below:
Deadlock Prevention
o Deadlock prevention method is suitable for a large database. If the resources are
allocated in such a way that deadlock never occurs, then the deadlock can be
prevented.
o The Database management system analyzes the operations of the transaction whether
they can create a deadlock situation or not. If they do, then the DBMS never allowed
that transaction to be executed.

Wait-Die scheme
In this scheme, if a transaction requests for a resource which is already held with a
conflicting lock by another transaction then the DBMS simply checks the timestamp of
both transactions. It allows the older transaction to wait until the resource is available
for execution.

Let's assume there are two transactions Ti and Tj and let TS(T) is a timestamp of any
transaction T. If T2 holds a lock by some other transaction and T1 is requesting for
resources held by T2 then the following actions are performed by DBMS:

1. Check if TS(Ti) < TS(Tj) - If Ti is the older transaction and Tj has held some resource,
then Ti is allowed to wait until the data-item is available for execution. That means if
the older transaction is waiting for a resource which is locked by the younger
transaction, then the older transaction is allowed to wait for resource until it is
available.
2. Check if TS(Ti) < TS(Tj) - If Ti is older transaction and has held some resource and if Tj is
waiting for it, then Tj is killed and restarted later with the random delay but with the
same timestamp.
Wound wait scheme
o In wound wait scheme, if the older transaction requests for a resource which is held by
the younger transaction, then older transaction forces younger one to kill the
transaction and release the resource. After the minute delay, the younger transaction is
restarted but with the same timestamp.
o If the older transaction has held a resource which is requested by the Younger
transaction, then the younger transaction is asked to wait until older releases it.

12 Codd's Rules
Every database has tables, and constraints cannot be referred to as a rational
database system. And if any database has only relational data model, it cannot be
a Relational Database System (RDBMS). So, some rules define a database to be
the correct RDBMS. These rules were developed by Dr. Edgar F. Codd (E.F. Codd) in 1985,
who has vast research knowledge on the Relational Model of database Systems. Codd
presents his 13 rules for a database to test the concept of DBMS against his relational
model, and if a database follows the rule, it is called a true relational database (RDBMS).
These 13 rules are popular in RDBMS, known as Codd's 12 rules.

Rule 0: The Foundation Rule


The database must be in relational form. So that the system can handle the database
through its relational capabilities.

Rule 1: Information Rule


A database contains various information, and this information must be stored in each
cell of a table in the form of rows and columns.

Rule 2: Guaranteed Access Rule


Every single or precise data (atomic value) may be accessed logically from a
relational database using the combination of primary key value, table name, and
column name.
Rule 3: Systematic Treatment of Null Values
This rule defines the systematic treatment of Null values in database records. The null
value has various meanings in the database, like missing the data, no value in a cell,
inappropriate information, unknown data and the primary key should not be null.

Rule 4: Active/Dynamic Online Catalog based on the relational


model
It represents the entire logical structure of the descriptive database that must be
stored online and is known as a database dictionary. It authorizes users to access the
database and implement a similar query language to access the database.

Rule 5: Comprehensive Data SubLanguage Rule


The relational database supports various languages, and if we want to access the
database, the language must be the explicit, linear or well-defined syntax, character
strings and supports the comprehensive: data definition, view definition, data
manipulation, integrity constraints, and limit transaction management operations. If
the database allows access to the data without any language, it is considered a
violation of the database.

Rule 6: View Updating Rule


All views table can be theoretically updated and must be practically updated by the
database systems.

Rule 7: Relational Level Operation (High-Level Insert, Update and


delete) Rule
A database system should follow high-level relational operations such as insert,
update, and delete in each level or a single row. It also supports union, intersection
and minus operation in the database system.

Rule 8: Physical Data Independence Rule


All stored data in a database or an application must be physically independent to
access the database. Each data should not depend on other data or an application. If
data is updated or the physical structure of the database is changed, it will not show
any effect on external applications that are accessing the data from the database.

Rule 9: Logical Data Independence Rule


It is similar to physical data independence. It means, if any changes occurred to the
logical level (table structures), it should not affect the user's view (application). For
example, suppose a table either split into two tables, or two table joins to create a
single table, these changes should not be impacted on the user view application.
Rule 10: Integrity Independence Rule
A database must maintain integrity independence when inserting data into table's
cells using the SQL query language. All entered values should not be changed or rely
on any external factor or application to maintain integrity. It is also helpful in making
the database-independent for each front-end application.

Rule 11: Distribution Independence Rule


The distribution independence rule represents a database that must work properly,
even if it is stored in different locations and used by different end-users. Suppose a
user accesses the database through an application; in that case, they should not be
aware that another user uses particular data, and the data they always get is only
located on one site. The end users can access the database, and these access data
should be independent for every user to perform the SQL queries.

Rule 12: Non Subversion Rule


The non-submersion rule defines RDBMS as a SQL language to store and manipulate
the data in the database. If a system has a low-level or separate language other than
SQL to access the database system, it should not subvert or bypass integrity to
transform data.

To create a new database using this tool, we first need to launch the MySQL
Workbench and log in using the username and password that you want. It will show
the following screen:
Now do the following steps for database creation:

 Go to the Navigation tab and click on the Schema menu.

 Here, we can see all the previously created databases.

 If we want to create a new database, right-click under the Schema menu and select
Create Schema or click the database icon (red rectangle), as shown in the
following screen.

 The new Schema window screen open.

 Enter the new database name (for example, employeedb) and use default
character set and collation.
 Now, click on the Apply button as shown in the screen below:

3. A new popup window appears. Click on the Apply button.

4. A new popup screen appears. Click on the Finish button to complete the database
creation.
5. After successful database creation, we can see new databases in the Schema
menu. If we do not see this, click on the refresh icon into the Schema menu.

6. We can see more information about the database by selecting the database and
click on the 'i' icon. The information window displays several options, like Table,
Triggers, Indexes, Users, and many more.

7. MySQL Workbench does not provide an option to rename the database name, but
we can create, update, and delete the table and data rows from the database.

DROP Database using MySQL Workbench

To drop a database using this tool, we first need to launch the MySQL Workbench and
log in with the username and password to the MySQL server. It will show the
following screen:
Now do the following steps for database deletion:

1. Go to the Navigation tab and click on the Schema menu. Here, we can see all the
previously created databases. If we want to delete a database, right-click the
database that you want to remove, for example, testdb_copy under the Schema
menu and select Drop Schema option, as shown in the following screen.
When we click the Drop Schema option, MySQL Workbench displays a dialog box to
confirm the deletion process. If we select Review SQL, it will produce
the SQL statement that will be executed. And if we choose Drop Now option, the
database will be deleted permanently.

If we want the safe deletion of the database, it is required to choose the Review SQL
option. Once we sure, click the Execute button to execute the statement. The below
screen explains it more clearly:

Once we click the execute button, MySQL will return the below message indicating
that the database is dropped successfully. Since the database testdb_copy is an
empty database, the number of affected rows is zero.
If we verify the schemas tab, we will not find the testdb_copy database on the list
anymore.

You might also like