D B M S: ATA ASE Anage Me NT Ystem
D B M S: ATA ASE Anage Me NT Ystem
D B M S: ATA ASE Anage Me NT Ystem
-Amrit Gupta
UNIT 1
UNIT 2
UNIT 3
Data integrity, integrity constraints, Auditing, backup and recovery. Data dictionary,
system catalogue, introduction to distributed data base. Introduction to client –
server and ODBS connectivity.
UNIT 5
Multi-user support
Security management
Advantages
Disadvantages
Hierarchical databases
Network databases
Object-oriented databases
Relational databases
NoSQL databases
Database Models
Hierarchical Databases:
Object,
Attribute
Method
Class
Database Models
In the chart above, we have different objects linked to one another using
methods; one can get the address of the Person (represented by the
Person Object) using the livesAt() method. Furthermore, these objects
have attributes which are in fact the data elements that need to be defined
in the database.
Database Models
Relational Databases:
Information stored in a database is capable of being
represented as an object which response as an instance
of the database model. Therefore, the object can be
referenced and called without any difficulty. As a result,
the workload on the database is substantially reduced.
Database Models
Advantages of NoSQL –
There are many advantages of working with NoSQL databases such as MongoDB and
Cassandra. The main advantages are high scalability and high availability.
Disadvantages of NoSQL –
NoSQL is an open-source database.
GUI is not available
Backup is a weak point for some NoSQL databases like MongoDB.
Large document size.
Classification of DBMS
1) Data Model
2) User Numbers
3) Database distribution
i. Centralized Systems
ii. Distributed database systems
iii. Homogenous distributed database systems
iv. Heterogeneous distributed database systems
Categorization of DBMS
T Y P E S O F D A T A B A SES
Non-relational databases
Non-relational databases place information in field categories that we create
so that information is available for sorting and disseminating the way we
need it.
The data in a non-relational database, however, is limited to that
program and cannot be extracted and applied to a number of other
software programs, or other database files
The data can only be "copied and pasted.“ Example: a spread sheet
Relational databases
In relational databases, fields can be used in a number of ways. It is
developed based on a database model that provides for logical
connections among files (known as tables) by including
identifying data from one table in another table
Dat abase A rchi tec ture
In the diagram,
2. Conceptual Level
- Conceptual level describes the structure of the whole database for a group of users, data
is represented in the form of various database tables.
- It is also called as the data model.
- Conceptual schema is a representation of the entire content of the database.
- These schema contains all the information to build relevant external records.
- It hides the internal details of physical storage.
3. External Level
- External level is related to the data which is viewed by individual end users.
- This level includes a no. of user views or external schemas. This level is closest to the
user.
- The main focus of external level is data abstraction.
- External view describes the segment of the database that is required for a particular
Advantages of DBMS
Minimized redundancy and data inconsistency: Data is normalized in DBMS to
minimize the redundancy which helps in keeping data consistent. For Example, student
information can be kept at one place in DBMS and accessed by different users.This
minimized redundancy is due to primary key and foreign keys
Simplified Data Access: A user need only name of the relation not exact location to
access data, so the process is very simple.
Multiple data views: Different views of same data can be created to cater the needs
of different users. For Example, faculty salary information can be hidden from student
view of data but shown in admin view.
Data Security: Only authorized users are allowed to access the data in DBMS. Also,
data can be encrypted by DBMS which makes it secure.
CREATE Statement:
CREATE TABLE [table name] ( [column definitions] ) [table parameters]
DDL (Data Definition Language)
DROP Statement:
The DROP statement destroys an existing database, table, index, or view.
ALTER Statement:
The ALTER statement modifies an existing database object.
TRUNCATE Statement:
TRUNCATE TABLE removes all rows from a table, but the table structure and
its columns, constraints, indexes, and so on remain. To remove the table
definition in addition to its data, use the DROP TABLE statement.
DML (Data Manipulation Language)
INSERT Statement:
INSERT INTO table_name (column1 [, column2, column3 ... ]) VALUES
(value1 [, value2, value3 ... ])
If you are adding values for all the columns of the table, you do not need to
specify the column names in the SQL query.
DELETE Statement:
The DELETE statement removes one or more records from a table.
DML (Data Manipulation Language)
UPDATE Statement:
The UPDATE statement changes the data of one or more records in
a table. Either all the rows can be updated, or a subset may be chosen
using a condition.
UPDATE table_name SET column_name = value [, column_name = value ...]
[WHERE condition]
DQL (Data Query Language)
DQL statements are used for performing queries on the data within schema
objects. The purpose of DQL commands is to get the schema relation based on
the query passed to it.
SELECT Statement:
The SELECT statement returns a result set of records, from one or more tables.
DCL Commands:
TCL Commands:
Example:
SAVEPOINT savepoint_name;
• Query Processor
• Storage Manager
• Disk Storage
DBMS Structure
1. Query Processor :
It interprets the requests (queries) received from end user via an
application program into instructions. It also executes the user request which
is received from the DML compiler.
Query Processor contains the following components –
• DML Compiler –
It processes the DML statements into low level instruction (machine
language), so that they can be executed.
• DDL Interpreter –
It processes the DDL statements into a set of table containing meta
data (data about data).
• Embedded DML Pre-compiler –
It processes DML statements embedded in an application program into
procedural calls.
• Query Optimizer –
It executes the instruction generated by DML Compiler.
DBMS Structure
2. Storage Manager :
Storage Manager is a program that provides an interface between the data stored in the database
and the queries received. It is also known as Database Control System. It maintains the consistency
and integrity of the database by applying the constraints and executes the DCL statements. It is
responsible for updating, storing, deleting, and retrieving data in the database.
It contains the following components –
• Authorization Manager –
It ensures role-based access control, i.e. checks whether the particular person is privileged to
perform the requested operation or not.
• Integrity Manager –
It checks the integrity constraints when the database is modified.
• Transaction Manager –
It controls concurrent access by performing the operations in a scheduled way that it receives the
transaction. Thus, it ensures that the database remains in the consistent state before and after the
execution of a transaction.
• File Manager –
It manages the file space and the data structure used to represent information in the database.
• Buffer Manager –
It is responsible for cache memory and the transfer of data between the secondary storage and
main memory.
DBMS Structure
3. Disk Storage :
It contains the following components –
• Data Files –
It stores the data.
• Data Dictionary –
It contains the information about the structure of any database
object. It is the repository of information that governs the
metadata.
• Indices –
It provides faster retrieval of data item.
N O R M A L I Z AT I O N
6-
6
• https://www.javatpoint.com/dbms-keys
EXAMPLE O F A R E L A T ION W I T H
ANOMALIES
6-7
Deletion anomaly
Insertion anomaly.
6-9
A n o m a l i e s i n t h e exa m pl e Re l a t i o n
•The value of the salary of each employee is repeated in all the tuples
relating to it: therefore there is a redundancy.
•If the salary of an employee changes, we have to modify the value in
all the corresponding tuples. This problem is known as the update
anomaly.
•If an employee stops working on all the projects but does not leave the
company, all the corresponding tuples are deleted and so, even the basic
information, name and salary is lost. This problem is known as the deletion
anomaly.
9.10
F IRST N O R M A L F O R M
A relation is in 1NF if and only if all underlying
domains contain atomic values.
Involves
• Removing repeating and place them in
groups separate table
• Also identify the primary key
6-
11
S E C O N D N O R M A L FO R M
A table is in 2NF if-
it is in 1NF
every non key attribute is fully functionally dependent on the
entire key and NOT PARTIALLY dependent.
Involves
• If an attribute depends on only part of a multi-valued key
remove it to a separate table
T HIR D N O R M A L F O R M
A table is in a 3NF if –
it is in 2NF and
it has no transitive dependencies for NPA,
9.14
UNIT 3
10.18
A T T R IB U T E S
Entities have attributes
• A characteristic of an entity that is of interest to an
organization
• Example: people have names and addresses
Example:
customer = (customer_id, customer_name, customer_street,
customer_city )
loan = (loan_number, amount )
Identifier
• A candidate key that has been selected as the unique
identifying characteristic for an entity type
Relationship
An association between the instances of one or more
•
entity types that is of interest to the organization
Depicting Entities and Attributes
C A R D IN A LIT Y
The number of instances of entity B that can
be associated with each instance of entity A
For a binary relationship the mapping
cardinality must be one of the following types:
• One to one
• One to many
• Many to one
• Many to many
A T T R IB U T E O F A R E L A T IO N S H IP S E T
SSN street
number balance
city
name
entity
attribute
relationship
E R D D E V E L O P M E N T P RO C ESS
Identify the entities
Determine the attributes for each entity
States of Transactions :
• Aborted − If any of the checks fails and the transaction has reached a failed
state, then the recovery manager rolls back all its write operations on the
database to bring the database back to its original state where it was prior to
the execution of the transaction. Transactions in this state are called aborted.
The database recovery module can select one of the two operations after a
transaction aborts −
Re-start the transaction
Kill the transaction
Lock-Based Protocols:
Database systems equipped with lock-based protocols use a mechanism by
which any transaction cannot read or write data until it acquires an appropriate
lock on it. Locks are of two kinds −
Binary Locks − A lock on a data item can be in two states; it is either locked or
unlocked.
Shared/exclusive − This type of locking mechanism differentiates the locks based
on their uses. If a lock is acquired on a data item to perform a write operation, it is
an exclusive lock. Allowing more than one transaction to write on the same data
item would lead the database into an inconsistent state. Read locks are shared
because no data value is being changed.
UNIT 4
Consider the
tables employees
and departments
and the business
rules for the
information in
each of the tables
Data Integrity
Integrity Constraints:
• Are a set of rules. It is used to maintain the quality of information.
• Ensure that the data insertion, updating, and other processes have to be performed in
such a way that data integrity is not affected.
• Is used to guard against accidental damage to the database.
Domain constraints
• Domain constraints can be defined as the definition of a valid set of values for
an attribute.
• The data type of domain includes string, character, integer, time, date, currency,
etc. The value of the attribute must be available in the corresponding domain.
Data Integrity
I N T E G R IT Y C O N S T R A INTS
An integrity constraint is a rule that restricts the values
that may be present in the database.
• The entity integrity constraint states that primary key value can't be null.
• This is because the primary key value is used to identify individual rows in
relation and if the primary key has a null value, then we can't identify
those rows.
• A table can contain a null value other than the primary key field.
Data Integrity
Key Constraints
• Keys are the entity set that is used to identify an entity within its entity set
uniquely.
• An entity set can have multiple keys, but out of which one key will be the
primary key. A primary key can contain a unique and null value in the
relational table.
Data Integrity
UNIQUE key constraint
is defined on the
DNAME column of
the dept table to
disallow rows with
duplicate department
names.
Data Integrity
• Has the DBA taken measures to draft and test the procedures to
protect as well as recover the databases from numerous types of
failures?
Database Backup & Recovery
• Have backup and recovery SLAs drafted and communicated to all stakeholders.
• Have the Disaster Recovery Plan (DRP) database portion drafted and
documented.
DEFINITION:
A collection of names, definitions, and attributes about data elements that
are being used or captured in a database, information system, or part of a
research project. It describes the meanings and purposes of data elements
within the context of a project, and provides guidance on interpretation,
accepted meanings and representation. A Data Dictionary also provides
metadata about data elements. The metadata included in a Data Dictionary can
assist in defining the scope and characteristics of data elements, as well the rules
for their usage and application.
USES:
• Assist in avoiding data inconsistencies across a project
• Help define conventions that are to be used across a project
• Provide consistency in the collection and use of data across multiple members
of a research team
• Make data easier to analyze
• Enforce the use of Data Standards
System Catalogue
A group of tables and views that incorporate vital details regarding a database.
Every database comprised of a system catalog and the information in the system
catalog specifies the framework of the database.
The system catalog is a set of objects, which includes information that defines:
• Other objects included in the database
• The database structure itself
• Several other vital pieces of information
The system catalogue intended for implementation can be split into logical groups of
objects. This is to offer tables that are accessible by not just the admin of the database, but
also by all other database users as well. For instance, users might want to see the specific
database privileges that they have been granted with; however, have no requirement to
find out regarding the database's processes or internal structure.
A user generally looks up the system catalogue to gain information regarding the
user's own objects as well as privileges, while the database admin must be capable of
inquiring about any event or structure inside the database. In certain implementations, one
can find system catalogue objects, which can be accessible only by the administrator of the
database.
Malicious Access :
• Unauthorized reading of data (theft of information)
• Unauthorized modification of data
• Unauthorized destruction of data