SlideShare a Scribd company logo
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Semester: SECOND Semester
Name of the Subject:
DATABASE MANAGEMENT SYSTEM
INTRODUCTION TO DBMS
UNIT-I
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Introduction to DBMS
• Purpose of Database Systems
• View of Data
• Data Models
• Data Definition Language
• Data Manipulation Language
• Transaction Management
• Storage Management
• Database Administrator
• Database Users
• Overall System Structure
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Unit 1
Introduction to DBMS
(Database Management Systems)
Application
program End-user
DBMS
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Database Management System (DMBS)
• Collection of interrelated data
• Set of programs to access the data
• DMBS contains information about a particular enterprise
• DBMS provides an environment that it both convenient and efficient to
use
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
• Major components of a database system:
• Data: integrated and shared.
• Hardware: disk, CPU, Main Memory, ...
• Software: DBMS
• Users:
1. Application programmers
2. End users
3. Database administrator (DBA)
» Defining external schema
» Defining conceptual schema
» Defining internal schema
» Liaison with users
» Defining security and integrity checks
» Defining backup and recovery procedures
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Purpose of Database Systems
Database management systems were developed to handle the
following difficulties of typical file-processing systems
supported by conventional operating systems:
• Data redundancy and inconsistency
• Difficulty in accessing data
• Data isolation – multiple files and formats
• Integrity problems
• Atomicity of updates
• Concurrent access by multiple users
• Security problems
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Why Database ?
• Redundancy can be reduced
• Inconsistency can be avoided
• The data can be shared
• Standards can be enforced
• Security restrictions can be applied
• Integrity can be maintained
• Provision of data independence
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Functions of the DBMS
• Data Definition Language (DDL)
• Data Manipulation Language (DML)
• Data Security and Integrity
• Data Recovery and Concurrency
• Data Dictionary
• Performance
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Levels of Abstraction
• Physical level: describes how a record (e.g. customer) is stored.
• Logical level: describes data stored in database, and the relationships
among the data.
type customer = record
name: string;
street: string;
city: integer;
end;
• View level: application programs hide details of data types. Views can
also hide information (e.g. salary) for security purposes.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Instances and Schemas
• Similar to types and variables in programming languages
• Schema – the logical structure of the database (e.g., set of customers
and accounts and the relationship between them)
• Instance – the actual content of the database at a particular point in
time
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Data Independence
• Ability to modify a schema definition in one level without affecting a
schema definition in the other levels.
• The interfaces between the various levels and components should be
well defined so that changes in some parts do not seriously influence
others.
• Two levels of data independence
– Physical data independence
– Logical data independence
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Data Models
• A collection of tools for describing:
– Data
– Data relationships
– Data semantics
– Data constraints
• Object-based logical models
– Entity-relationship model
– Object-oriented model
– Semantic model
– Functional model
• Record-based logical models
– Relational model (e.g., SQL/DS, DB2)
– Network model
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Distributed Databases
Database Distributed System
• Distributed database is a database that is not stored in its entirety at a
single physical location, but rather is spread across a network of
computer.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Distributed Databases
• Advantages:
– efficiency of local processing
– data sharing
• Disadvantages:
– communication overhead
– implementation difficulties
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Data Definition Language (DDL)
• Specification notation for defining the database schema
• DDL compiler generates a set of tables stored in a data dictionary
• Data dictionary contains metadata (data about data)
• Data storage and definition language – special type of DDL in which
the storage structure and access methods used by the database system
are specified.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Data Manipulation Language (DML)
• Language for accessing and manipulating the data organized by the
appropriate data model
• Two classes of languages
– Procedural – user specifies what data is required and how to get
those data
– Nonprocedural – user specifies what data is required without
specifying how to get those data
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Transaction Management
• A transaction is a collection of operations that performs a single logical
function in a database application.
• Transaction-management component ensures that the database remains
in a consistent (correct) state despite system failures (e.g. power
failures and operating system crashes) and transaction failures.
• Concurrency-control manager controls the interaction among the
concurrent transactions, to ensure the consistency of the database.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Storage Management
• A storage manager is a program module that provides the 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 the following tasks:
– Interaction with the file manager
– Efficient storing, retrieving, and updating of data
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Database Administrator
• Coordinates all the activities of the database system; the database
administrator has a good understanding of the enterprise’s information
resources and needs:
• Database administrator’s duties include:
– Schema definition
– Storage structure and access method definition
– Schema and physical organization modification
– Granting user authority to access the database
– Specifying integrity constraints
– Acting as liaison with users
– Monitoring performance and responding to changes in requirements
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Semester: Second Semester
Name of the Subject:
DATABASE MANAGEMENT SYSTEM
INTRODUCTION TO SQL
UNIT-II
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
History of SQL
• SQL: Structured Query Language
• SQL is based on the relational tuple calculus
• SEQUEL: Structured English QUEry Language; part of SYSTEM R, 1974
• SQL/86: ANSI & ISO standard
• SQL/89: ANSI & ISO standard
• SQL/92 or SQL2: ANSI & ISO standard
• SQL3: in the works.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
SQL
SQL consists of the following parts:
• Data Definition Language (DDL)
• Interactive Data Manipulation Language (Interactive DML)
• Embedded Data Manipulation Language (Embedded DML)
• Views
• Integrity
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Objectives
• Explore basic commands and functions of SQL
• How to use SQL for data administration (to create tables, indexes, and
views)
• How to use SQL for data manipulation (to add, modify, delete, and retrieve
data)
• How to use SQL to query a database to extract useful information
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Introduction to SQL
• SQL functions fit into two broad categories:
– Data definition language
• SQL includes commands to:
– Create database objects, such as tables, indexes, and views
– Define access rights to those database objects
– Data manipulation language
• Includes commands to insert, update, delete, and retrieve data
within database tables
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
• SQL is relatively easy to learn
• Basic command set has vocabulary of less than 100 words
• Nonprocedural language
• American National Standards Institute (ANSI) prescribes a standard SQL
• Several SQL dialects exist
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Introduction to SQL
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Introduction to SQL (continued)
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Introduction to SQL (continued)
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Data Definition Commands
• Examine simple database model and database tables that will form basis for
many SQL examples
• Understand data environment
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
The Database Model
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Creating the Database
• Following two tasks must be completed:
– Create database structure
– Create tables that will hold end-user data
• First task:
– RDBMS creates physical files that will hold database
– Tends to differ substantially from one RDBMS to another
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
The Database Schema
• Authentication
– Process through which DBMS verifies that only registered users
are able to access database
– Log on to RDBMS using user ID and password created by
database administrator
• Schema
– Group of database objects—such as tables and indexes—that are
related to each other
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Data Types
• Data type selection is usually dictated by nature of data and by intended use
• Pay close attention to expected use of attributes for sorting and data
retrieval purposes
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Data Types (continued)
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Creating Table Structures
• Use one line per column (attribute) definition
• Use spaces to line up attribute characteristics and constraints
• Table and attribute names are capitalized
• NOT NULL specification
• UNIQUE specification
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
SQL Constraints
• NOT NULL constraint
– Ensures that column does not accept nulls
• UNIQUE constraint
– Ensures that all values in column are unique
• DEFAULT constraint
– Assigns value to attribute when a new row is added to table
• CHECK constraint
– Validates data when attribute value is entered
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
SQL Indexes
• When primary key is declared, DBMS automatically creates unique index
• Often need additional indexes
• Using CREATE INDEX command, SQL indexes can be created on basis of
any selected attribute
• Composite index
– Index based on two or more attributes
– Often used to prevent data duplication
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Summary
• Many SQL constraints can be used with columns.
• The column list represents one or more column names separated by
commas.
• WHERE clause can be used with SELECT, UPDATE, and DELETE
statements to restrict rows affected by the DDL command.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Semester: SECOND Semester
Name of the Subject:
DBMS
RELATIONAL DATA MODEL
UNIT-III
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Relational Data Model
• In the relational data model the database is represented as a group of
related tables.
• The relational data model was introduced in 1970 by E. F. Codd of IBM
published a paper in CACM entitled "A Relational Model of Data for
Large Shared Data Banks".
• It is currently the most popular model. The mathematical simplicity and
ease of visualization of the relational data model have contributed to its
success.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Definitions of Terminology
Formal relational term Informal equivalents
relation table
tuple row or record
cardinality number of rows
attribute column or field
degree number of columns
(unique) identifier Primary key
domain pool of legal values
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Characteristics of a Relation (table)
• Two-dimensional structure with rows and columns
• A relation represent a single entity
• Each table must have an attribute to uniquely identify each row
• Column values all have same data type
• Order of the rows and columns is immaterial to the DBMS
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Properties of a Relation
• Based on the set theory
• 1. There are no duplicate tuples (rows).
– The body of the relation is a mathematical set (i.e., a set of
tuples), and sets in mathematics by definition do not include
duplicate elements.
– If a "relation" contains duplicate tuples, then it is not a relation.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Properties of a Relation
• 2. Tuples (rows) are unordered (top to bottom).
– Sets in mathematics are not ordered. So, even if a relation A's
tuples are reversely ordered, it is still the same relation.
– Thus, there is no such thing as "the 5th tuple" or the last tuple.
In other words, there is no concept of positional addressing.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Properties of a Relation
• Based on the set theory
• 1. There are no duplicate tuples (rows).
– The body of the relation is a mathematical set (i.e., a set of
tuples), and sets in mathematics by definition do not include
duplicate elements.
– If a "relation" contains duplicate tuples, then it is not a relation.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Properties of a Relation
4. All attribute values are atomic.
– At every row-and-column position within the table, there always
exists precisely one value, never a list of values. Or equivalently,
relations do not contain repeating groups.
– A relation satisfying this condition is said to be in First Normal Form.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Primary Key
• A PK is an attribute, or collection of attributes, whose values
uniquely identify each tuple in a relation.
• To being unique, a PK must be minimal (contain no
unnecessary attributes)
• and must not change in value.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Entity Integrity Rule
• Guarantees that each entity will have a unique identity and ensures that
foreign key values can properly reference primary key values.
• Requirement
– No component of the primary key is allowed to accept nulls.
– By "null" here, we mean that information is missing for some reason.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Foreign Key
• An attribute in one table whose values must either match the
primary key in another table or be null.
• Attribute FK of base relation R2 is a foreign key if and only if it
satisfies the following two time-independent properties:
– Each value of FK is either wholly null or wholly non-null.
– Each non-null value of FK is identical to the value of PK in
some tuple of R1.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Referential Integrity Rule
• The database must not contain any unmatched foreign key values.
• Just as primary key values represent entity identifiers, so foreign key
values represent entity references.
• The referential integrity rule simply says that if B references A, then
A must exist.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Select Operation
• Notation:  p(r) lowercase Greek sigma 
• p is called the selection predicate
• Defined as:
p(r) = {t | t  r and p(t)}
Where p is a formula in propositional calculus consisting of terms connected by :
 (and),  (or),  (not)
Each term is one of:
<attribute> op <attribute> or <constant>
where op is one of: =, , >, . <. 
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Union Operation
• Notation: r  s
• Defined as:
r  s = {t | t  r or t  s}
For r  s to be valid.
1. r, s must have the same arity (same number of attributes)
2. The attribute domains must be compatible (e.g., 2nd column
of r deals with the same type of values as does the 2nd
column of s).
Although the field types must be the same, the names can be different. For example
I can union professor and lecturer where:
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
The Data Normalization Process
• A methodology for organizing attributes into tables so that
redundancy among the nonkey attributes is eliminated.
• The output of the data normalization process is a properly structured
relational database.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
The Data Normalization Technique
• Input:
– all the attributes that must be incorporated into the database
– a list of all the defining associations between the attributes (i.e.,
the functional dependencies).
• a means of expressing that the value of one particular
attribute is associated with a single, specific value of another
attribute.
• If we know that one of these attributes has a particular value,
then the other attribute must have some other value.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Full Functional dependency:
• If A and B are attributes(columns)of a table, B is fully functionally dependent
on A if B is functionally dependent on A, but not on any proper subset of A.
SalesPerson#--SalesPersonName
•Partial Functional Dependency:
• If A and B are attributes of a table, B is partially dependent on A if there is
some attribute that can be removed from A and yet the dependency still holds.
SP#, SPName -------> Comm%
•Transitive Functional Dependency:
• A , B and C are attributes of a table. If A is functionally dependent on B, and B
is functionally dependent on C, then C is Transitively dependent on A via B.
.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Logical Design of Relational Database Systems
• The conversion of E-R diagrams into relational tables.
• The data normalization technique.
• The use of the data normalization technique to test the tables resulting from the E-
R diagram conversions.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Second Normal Form
A Table is said to be in 2NF if it is in 1NF and there are no partial
dependencies
No Partial Functional Dependencies
Every non primary key attribute of the table must be fully functionally
dependent on the entire primary key of that table.
A non-key attribute cannot depend on only part of the key.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Third Normal Form
• A Table that is in 1NF and 2NF and in which no non primary key attribute is
transitively dependent on the primary key.
• Does not allow transitive dependencies in which one nonkey attribute is
functionally dependent on another.
• Nonkey attributes are not allowed to define other nonkey attributes.
• "Each attribute must be a fact about the key, the whole key, and nothing but the
key."
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Boyce-codd Normal Form (BCNF)
• A Table is in BCNF if and only if every determinant (i.e., the attribute or a
group of attributes on which some other attribute is fully functionally
dependent) is a candidate key. BCNF is a stronger form of 3NF.
• The difference between 3NF and BCNF is that for a Functional dependency
A--->B, 3NF allows this dependency in a table if attribute B is a primary key
attribute and attribute A is not a candidate key, where as BCNF insists that
for this dependency to remain in a table, attribute A must be a candidate key.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Semester: SECOND Semester
Name of the Subject:
DBMS
TRANSACTION PROCESSING AND
CONCURRENCY CONTROL
UNIT-IV
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Transaction
• Any action that reads from and/or writes to a database may consist of:
– Simple SELECT statement to generate list of table contents
– Series of related UPDATE statements to change values of attributes in
various tables
– Series of INSERT statements to add rows to one or more tables
– Combination of SELECT, UPDATE, and INSERT statements
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
• Transaction is logical unit of work that must be either entirely completed
or aborted
• Successful transaction changes database from one consistent state to
another
– One in which all data integrity constraints are satisfied
• Most real-world database transactions are formed by two or more
database requests
– Equivalent of a single SQL statement in an application program or
transaction
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Evaluating Transaction Results
• Not all transactions update database
• SQL code represents a transaction because database was accessed
• Improper or incomplete transactions can have devastating effect on
database integrity
– Some DBMSs provide means by which user can define enforceable
constraints
– Other integrity rules are enforced automatically by the DBMS
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
The ACID Properties
• Atomicity
– Requires that all operations (SQL requests) of a transaction be
completed
• Consistency
– Indicates the permanence of database’s consistent state
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
• Isolation
– Data used during execution of a transaction cannot be used by
second transaction until first one is completed
• Durability
– Indicates permanence of database’s consistent state Isolation
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Transaction Management with SQL
• ANSI standards require that, when a transaction sequence is initiated by a user
or an application program, it must continue through all succeeding SQL
statements until one of four events occurs
– COMMIT statement is reached
– ROLLBACK statement is reached
– Program is abnormally terminated
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Concurrency Control
• Coordination of simultaneous transaction execution in a
multiprocessing database system
• Objective is to ensure serializability of transactions in a multiuser
database environment
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Scheduling Algorithms
• Modify concurrency control schemes for use in distributed environment.
There are 3 basic methods for transaction concurrency control.
• Locking (two phase locking - 2PL).
• Timestamp ordering
• Optimistic
• Hybrid
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Locking Protocols
• Majority Protocol
• Local lock manager at each site administers lock and unlock requests for
data items stored at that site.
• When a transaction wishes to lock an un replicated data item Q residing
at site Si, a message is sent to Si ‘s lock manager.
• If Q is locked in an incompatible mode, then the request is delayed
until it can be granted.
• When the lock request can be granted, the lock manager sends a
message back to the initiator indicating that the lock request has been
granted.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Timestamp Ordering
• Timestamp (TS): a number associated with each transaction
– Not necessarily real time
• Can be assigned by a logical counter
– Unique for each transaction
– Should be assigned in an increasing order for each new transaction
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Concurrency Control
with Locking Methods
• Lock
– Guarantees exclusive use of a data item to a current transaction
– Required to prevent another transaction from reading inconsistent
data
• Lock manager
– Responsible for assigning and policing the locks used by
transactions
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Lock Granularity
• Indicates level of lock use
• Locking can take place at following levels:
– Database
– Table
– Page
– Row
– Field (attribute)
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Lock Types
• Binary lock
– Has only two states: locked (1) or unlocked (0)
• Exclusive lock
– Access is specifically reserved for transaction that locked object
– Must be used when potential for conflict exists
• Shared lock
– Concurrent transactions are granted Read access on basis of a
common lock
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Serializability Challenges
Given a set of transactions that execute concurrently, the goal is:
• to find a schedule equivalent to some serial order
• maximize throughput and concurrency
Thus, exclude the trivial solution of running transactions one at a time.
But, theory is not perfect:
• given an arbitrary mix of reads and writes from different transactions,
finding out all possible serializable orders is NP-complete.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Serializability
Given all the reads and writes from all active transactions, a scheduling
of these operations is serializable if the schedule produces the same
effect on the database as some serial execution of the same transactions.
Why does it help?
By definition, a serial execution of transactions does not have any
concurrency control problem, since each transaction executes to
completion before the next one is allowed to start
If we can find a serializable schedule, then the isolation property is
satisfied.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Concurrency Control
with Time Stamping Methods
• Assigns global unique time stamp to each transaction
• Produces explicit order in which transactions are submitted to DBMS
• Uniqueness
– Ensures that no equal time stamp values can exist
• Monotonicity
– Ensures that time stamp values always increase
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Wait/Die and Wound/Wait Schemes
• Wait/die
– Older transaction waits and younger is rolled back and
rescheduled
• Wound/wait
– Older transaction rolls back younger transaction and
reschedules it
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Lock-Based Concurrency Control
• A DBMS ensures that only serializable schedules are allowed by using a
suitable CC protocol.
• Strict Two-phase Locking (Strict 2PL) Protocol
• Strict 2PL does however allow deadlocks, i.e. cycles of transactions
waiting for locks to be released. A DBMS must either prevent or detect
(and resolve) deadlocks.
Chanderprabhu Jain College of Higher Studies & School of Law
Plot No. OCF, Sector A-8, Narela, New Delhi – 110040
(Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India)
Summary
• Concurrency control and recovery are among the most important functions
provided by a DBMS.
• Users need not worry about concurrency.
– System automatically inserts lock/unlock requests and schedules actions
of different Xacts in such a way as to ensure that the resulting execution
is equivalent to executing the Xacts one after the other in some order.
• Write-ahead logging (WAL) is used to undo the actions of aborted
transactions and to restore the system to a consistent state after a crash.
– Consistent state: Only the effects of commited Xacts seen.

More Related Content

What's hot

Data models
Data modelsData models
Data models
Dhani Ahmad
 
Dbms database models
Dbms database modelsDbms database models
Dbms database models
sanjeev kumar suman
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
Bishrul Haq
 
Presentation of DBMS (database management system) part 1
Presentation of DBMS (database management system) part 1Presentation of DBMS (database management system) part 1
Presentation of DBMS (database management system) part 1
Junaid Nadeem
 
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSEOLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSE
Zalpa Rathod
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Vraj Patel
 
Data models
Data modelsData models
Data models
Usman Tariq
 
Database Management System, Lecture-1
Database Management System, Lecture-1Database Management System, Lecture-1
Database Management System, Lecture-1
Sonia Mim
 
Adbms 17 object query language
Adbms 17 object query languageAdbms 17 object query language
Adbms 17 object query language
Vaibhav Khanna
 
Database recovery
Database recoveryDatabase recovery
Database recovery
Vritti Malhotra
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
Vignesh Saravanan
 
Query evaluation and optimization
Query evaluation and optimizationQuery evaluation and optimization
Query evaluation and optimization
lavanya marichamy
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
Soumyajit Dutta
 
08. Object Oriented Database in DBMS
08. Object Oriented Database in DBMS08. Object Oriented Database in DBMS
08. Object Oriented Database in DBMS
koolkampus
 
Database Concepts and Components
Database Concepts and ComponentsDatabase Concepts and Components
Database Concepts and Components
RIAH ENCARNACION
 
Chapter-2 Database System Concepts and Architecture
Chapter-2 Database System Concepts and ArchitectureChapter-2 Database System Concepts and Architecture
Chapter-2 Database System Concepts and Architecture
Kunal Anand
 
Indexing Data Structure
Indexing Data StructureIndexing Data Structure
Indexing Data Structure
Vivek Kantariya
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
Archit Saxena
 
Database user and administrator.pptx
Database user and administrator.pptxDatabase user and administrator.pptx
Database user and administrator.pptx
Anusha sivakumar
 
DATA BASE MANAGEMENT SYSTEM BY SAIKIRAN PANJALA
DATA BASE  MANAGEMENT SYSTEM BY SAIKIRAN PANJALADATA BASE  MANAGEMENT SYSTEM BY SAIKIRAN PANJALA
DATA BASE MANAGEMENT SYSTEM BY SAIKIRAN PANJALA
Saikiran Panjala
 

What's hot (20)

Data models
Data modelsData models
Data models
 
Dbms database models
Dbms database modelsDbms database models
Dbms database models
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 
Presentation of DBMS (database management system) part 1
Presentation of DBMS (database management system) part 1Presentation of DBMS (database management system) part 1
Presentation of DBMS (database management system) part 1
 
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSEOLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSE
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Data models
Data modelsData models
Data models
 
Database Management System, Lecture-1
Database Management System, Lecture-1Database Management System, Lecture-1
Database Management System, Lecture-1
 
Adbms 17 object query language
Adbms 17 object query languageAdbms 17 object query language
Adbms 17 object query language
 
Database recovery
Database recoveryDatabase recovery
Database recovery
 
Integrity constraints in dbms
Integrity constraints in dbmsIntegrity constraints in dbms
Integrity constraints in dbms
 
Query evaluation and optimization
Query evaluation and optimizationQuery evaluation and optimization
Query evaluation and optimization
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
08. Object Oriented Database in DBMS
08. Object Oriented Database in DBMS08. Object Oriented Database in DBMS
08. Object Oriented Database in DBMS
 
Database Concepts and Components
Database Concepts and ComponentsDatabase Concepts and Components
Database Concepts and Components
 
Chapter-2 Database System Concepts and Architecture
Chapter-2 Database System Concepts and ArchitectureChapter-2 Database System Concepts and Architecture
Chapter-2 Database System Concepts and Architecture
 
Indexing Data Structure
Indexing Data StructureIndexing Data Structure
Indexing Data Structure
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Database user and administrator.pptx
Database user and administrator.pptxDatabase user and administrator.pptx
Database user and administrator.pptx
 
DATA BASE MANAGEMENT SYSTEM BY SAIKIRAN PANJALA
DATA BASE  MANAGEMENT SYSTEM BY SAIKIRAN PANJALADATA BASE  MANAGEMENT SYSTEM BY SAIKIRAN PANJALA
DATA BASE MANAGEMENT SYSTEM BY SAIKIRAN PANJALA
 

Similar to Introduction To Database Management System

DBMS presentation
DBMS presentationDBMS presentation
OPPS using C++
OPPS using C++ OPPS using C++
Object oriented programming using BCA 209
Object oriented programming using BCA 209Object oriented programming using BCA 209
Object oriented programming using BCA 209
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
RDBMS
RDBMSRDBMS
Data Ware Housing And Data Mining
Data Ware Housing And Data MiningData Ware Housing And Data Mining
Unit1,2 economics best ppt ever made.pptx
Unit1,2 economics best ppt ever made.pptxUnit1,2 economics best ppt ever made.pptx
Unit1,2 economics best ppt ever made.pptx
SwastikSharma42
 
Information Systems Management
Information Systems Management Information Systems Management
FRONT END DESIGN TOOL VB.NET
FRONT END DESIGN TOOL VB.NET FRONT END DESIGN TOOL VB.NET
Computer Applications
Computer ApplicationsComputer Applications
Anshu Joshi_2371050_DBMS.pptxData base management system
Anshu Joshi_2371050_DBMS.pptxData base management systemAnshu Joshi_2371050_DBMS.pptxData base management system
Anshu Joshi_2371050_DBMS.pptxData base management system
anshjoshi7417
 
Front End Design Tool VB.Net BCA 205
Front End Design Tool VB.Net BCA 205Front End Design Tool VB.Net BCA 205
Management Information System
Management Information SystemManagement Information System
Web programming PHP BCA 313
Web programming PHP BCA 313Web programming PHP BCA 313
Computer Applications
Computer ApplicationsComputer Applications
Introduction to operating system
Introduction to operating systemIntroduction to operating system
System Analysis And Design
System Analysis And DesignSystem Analysis And Design
System Analysis And Design
Lijo Stalin
 
Bi 5
Bi 5Bi 5
Bi 5
shivz3
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
Dr. Mazin Mohamed alkathiri
 
2019 DSA 105 Introduction to Data Science Week 5
2019 DSA 105 Introduction to Data Science Week 52019 DSA 105 Introduction to Data Science Week 5
2019 DSA 105 Introduction to Data Science Week 5
Ferdin Joe John Joseph PhD
 
Management Information System
Management Information SystemManagement Information System

Similar to Introduction To Database Management System (20)

DBMS presentation
DBMS presentationDBMS presentation
DBMS presentation
 
OPPS using C++
OPPS using C++ OPPS using C++
OPPS using C++
 
Object oriented programming using BCA 209
Object oriented programming using BCA 209Object oriented programming using BCA 209
Object oriented programming using BCA 209
 
RDBMS
RDBMSRDBMS
RDBMS
 
Data Ware Housing And Data Mining
Data Ware Housing And Data MiningData Ware Housing And Data Mining
Data Ware Housing And Data Mining
 
Unit1,2 economics best ppt ever made.pptx
Unit1,2 economics best ppt ever made.pptxUnit1,2 economics best ppt ever made.pptx
Unit1,2 economics best ppt ever made.pptx
 
Information Systems Management
Information Systems Management Information Systems Management
Information Systems Management
 
FRONT END DESIGN TOOL VB.NET
FRONT END DESIGN TOOL VB.NET FRONT END DESIGN TOOL VB.NET
FRONT END DESIGN TOOL VB.NET
 
Computer Applications
Computer ApplicationsComputer Applications
Computer Applications
 
Anshu Joshi_2371050_DBMS.pptxData base management system
Anshu Joshi_2371050_DBMS.pptxData base management systemAnshu Joshi_2371050_DBMS.pptxData base management system
Anshu Joshi_2371050_DBMS.pptxData base management system
 
Front End Design Tool VB.Net BCA 205
Front End Design Tool VB.Net BCA 205Front End Design Tool VB.Net BCA 205
Front End Design Tool VB.Net BCA 205
 
Management Information System
Management Information SystemManagement Information System
Management Information System
 
Web programming PHP BCA 313
Web programming PHP BCA 313Web programming PHP BCA 313
Web programming PHP BCA 313
 
Computer Applications
Computer ApplicationsComputer Applications
Computer Applications
 
Introduction to operating system
Introduction to operating systemIntroduction to operating system
Introduction to operating system
 
System Analysis And Design
System Analysis And DesignSystem Analysis And Design
System Analysis And Design
 
Bi 5
Bi 5Bi 5
Bi 5
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
2019 DSA 105 Introduction to Data Science Week 5
2019 DSA 105 Introduction to Data Science Week 52019 DSA 105 Introduction to Data Science Week 5
2019 DSA 105 Introduction to Data Science Week 5
 
Management Information System
Management Information SystemManagement Information System
Management Information System
 

More from CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW

Tax Law (LLB-403)
Tax Law (LLB-403)Tax Law (LLB-403)
Law and Emerging Technology (LLB -405)
 Law and Emerging Technology (LLB -405) Law and Emerging Technology (LLB -405)
Law and Emerging Technology (LLB -405)
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
Law of Crimes-I ( LLB -205)
 Law of Crimes-I  ( LLB -205)  Law of Crimes-I  ( LLB -205)
Socio-Legal Dimensions of Gender (LLB-507 & 509 )
Socio-Legal Dimensions of Gender (LLB-507 & 509 )Socio-Legal Dimensions of Gender (LLB-507 & 509 )
Socio-Legal Dimensions of Gender (LLB-507 & 509 )
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
Family Law-I ( LLB -201)
Family Law-I  ( LLB -201) Family Law-I  ( LLB -201)
Alternative Dispute Resolution (ADR) [LLB -309]
Alternative Dispute Resolution (ADR) [LLB -309] Alternative Dispute Resolution (ADR) [LLB -309]
Alternative Dispute Resolution (ADR) [LLB -309]
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
Law of Evidence (LLB-303)
Law of Evidence  (LLB-303) Law of Evidence  (LLB-303)
Environmental Studies and Environmental Laws (: LLB -301)
Environmental Studies and Environmental Laws (: LLB -301)Environmental Studies and Environmental Laws (: LLB -301)
Environmental Studies and Environmental Laws (: LLB -301)
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
Code of Civil Procedure (LLB -307)
 Code of Civil Procedure (LLB -307) Code of Civil Procedure (LLB -307)
Constitutional Law-I (LLB -203)
 Constitutional Law-I (LLB -203) Constitutional Law-I (LLB -203)
Women and Law [LLB 409 (c)]
Women and Law [LLB 409 (c)]Women and Law [LLB 409 (c)]
Corporate Law ( LLB- 305)
Corporate Law ( LLB- 305)Corporate Law ( LLB- 305)
Human Rights Law ( LLB -407)
 Human Rights Law ( LLB -407) Human Rights Law ( LLB -407)
Labour Law-I (LLB 401)
 Labour Law-I (LLB 401) Labour Law-I (LLB 401)
Legal Ethics and Court Craft (LLB 501)
 Legal Ethics and Court Craft (LLB 501) Legal Ethics and Court Craft (LLB 501)
Legal Ethics and Court Craft (LLB 501)
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
Political Science-II (BALLB- 209)
Political Science-II (BALLB- 209)Political Science-II (BALLB- 209)
Health Care Law ( LLB 507 & LLB 509 )
Health Care Law ( LLB 507 & LLB 509 )Health Care Law ( LLB 507 & LLB 509 )
Land and Real Estate Laws (LLB-505)
Land and Real Estate Laws (LLB-505)Land and Real Estate Laws (LLB-505)
Business Environment and Ethical Practices (BBA LLB 213 )
Business Environment and Ethical Practices (BBA LLB 213 )Business Environment and Ethical Practices (BBA LLB 213 )
Business Environment and Ethical Practices (BBA LLB 213 )
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 
HUMAN RESOURCE MANAGEMENT (BBA LLB215 )
HUMAN RESOURCE MANAGEMENT (BBA LLB215 )HUMAN RESOURCE MANAGEMENT (BBA LLB215 )
HUMAN RESOURCE MANAGEMENT (BBA LLB215 )
CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW
 

More from CHANDERPRABHU JAIN COLLEGE OF HIGHER STUDIES & SCHOOL OF LAW (20)

Tax Law (LLB-403)
Tax Law (LLB-403)Tax Law (LLB-403)
Tax Law (LLB-403)
 
Law and Emerging Technology (LLB -405)
 Law and Emerging Technology (LLB -405) Law and Emerging Technology (LLB -405)
Law and Emerging Technology (LLB -405)
 
Law of Crimes-I ( LLB -205)
 Law of Crimes-I  ( LLB -205)  Law of Crimes-I  ( LLB -205)
Law of Crimes-I ( LLB -205)
 
Socio-Legal Dimensions of Gender (LLB-507 & 509 )
Socio-Legal Dimensions of Gender (LLB-507 & 509 )Socio-Legal Dimensions of Gender (LLB-507 & 509 )
Socio-Legal Dimensions of Gender (LLB-507 & 509 )
 
Family Law-I ( LLB -201)
Family Law-I  ( LLB -201) Family Law-I  ( LLB -201)
Family Law-I ( LLB -201)
 
Alternative Dispute Resolution (ADR) [LLB -309]
Alternative Dispute Resolution (ADR) [LLB -309] Alternative Dispute Resolution (ADR) [LLB -309]
Alternative Dispute Resolution (ADR) [LLB -309]
 
Law of Evidence (LLB-303)
Law of Evidence  (LLB-303) Law of Evidence  (LLB-303)
Law of Evidence (LLB-303)
 
Environmental Studies and Environmental Laws (: LLB -301)
Environmental Studies and Environmental Laws (: LLB -301)Environmental Studies and Environmental Laws (: LLB -301)
Environmental Studies and Environmental Laws (: LLB -301)
 
Code of Civil Procedure (LLB -307)
 Code of Civil Procedure (LLB -307) Code of Civil Procedure (LLB -307)
Code of Civil Procedure (LLB -307)
 
Constitutional Law-I (LLB -203)
 Constitutional Law-I (LLB -203) Constitutional Law-I (LLB -203)
Constitutional Law-I (LLB -203)
 
Women and Law [LLB 409 (c)]
Women and Law [LLB 409 (c)]Women and Law [LLB 409 (c)]
Women and Law [LLB 409 (c)]
 
Corporate Law ( LLB- 305)
Corporate Law ( LLB- 305)Corporate Law ( LLB- 305)
Corporate Law ( LLB- 305)
 
Human Rights Law ( LLB -407)
 Human Rights Law ( LLB -407) Human Rights Law ( LLB -407)
Human Rights Law ( LLB -407)
 
Labour Law-I (LLB 401)
 Labour Law-I (LLB 401) Labour Law-I (LLB 401)
Labour Law-I (LLB 401)
 
Legal Ethics and Court Craft (LLB 501)
 Legal Ethics and Court Craft (LLB 501) Legal Ethics and Court Craft (LLB 501)
Legal Ethics and Court Craft (LLB 501)
 
Political Science-II (BALLB- 209)
Political Science-II (BALLB- 209)Political Science-II (BALLB- 209)
Political Science-II (BALLB- 209)
 
Health Care Law ( LLB 507 & LLB 509 )
Health Care Law ( LLB 507 & LLB 509 )Health Care Law ( LLB 507 & LLB 509 )
Health Care Law ( LLB 507 & LLB 509 )
 
Land and Real Estate Laws (LLB-505)
Land and Real Estate Laws (LLB-505)Land and Real Estate Laws (LLB-505)
Land and Real Estate Laws (LLB-505)
 
Business Environment and Ethical Practices (BBA LLB 213 )
Business Environment and Ethical Practices (BBA LLB 213 )Business Environment and Ethical Practices (BBA LLB 213 )
Business Environment and Ethical Practices (BBA LLB 213 )
 
HUMAN RESOURCE MANAGEMENT (BBA LLB215 )
HUMAN RESOURCE MANAGEMENT (BBA LLB215 )HUMAN RESOURCE MANAGEMENT (BBA LLB215 )
HUMAN RESOURCE MANAGEMENT (BBA LLB215 )
 

Recently uploaded

Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
Celine George
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
David Douglas School District
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 

Recently uploaded (20)

Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 

Introduction To Database Management System

  • 1. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Semester: SECOND Semester Name of the Subject: DATABASE MANAGEMENT SYSTEM INTRODUCTION TO DBMS UNIT-I
  • 2. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Introduction to DBMS • Purpose of Database Systems • View of Data • Data Models • Data Definition Language • Data Manipulation Language • Transaction Management • Storage Management • Database Administrator • Database Users • Overall System Structure
  • 3. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Unit 1 Introduction to DBMS (Database Management Systems) Application program End-user DBMS
  • 4. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Database Management System (DMBS) • Collection of interrelated data • Set of programs to access the data • DMBS contains information about a particular enterprise • DBMS provides an environment that it both convenient and efficient to use
  • 5. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) • Major components of a database system: • Data: integrated and shared. • Hardware: disk, CPU, Main Memory, ... • Software: DBMS • Users: 1. Application programmers 2. End users 3. Database administrator (DBA) » Defining external schema » Defining conceptual schema » Defining internal schema » Liaison with users » Defining security and integrity checks » Defining backup and recovery procedures
  • 6. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Purpose of Database Systems Database management systems were developed to handle the following difficulties of typical file-processing systems supported by conventional operating systems: • Data redundancy and inconsistency • Difficulty in accessing data • Data isolation – multiple files and formats • Integrity problems • Atomicity of updates • Concurrent access by multiple users • Security problems
  • 7. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Why Database ? • Redundancy can be reduced • Inconsistency can be avoided • The data can be shared • Standards can be enforced • Security restrictions can be applied • Integrity can be maintained • Provision of data independence
  • 8. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Functions of the DBMS • Data Definition Language (DDL) • Data Manipulation Language (DML) • Data Security and Integrity • Data Recovery and Concurrency • Data Dictionary • Performance
  • 9. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Levels of Abstraction • Physical level: describes how a record (e.g. customer) is stored. • Logical level: describes data stored in database, and the relationships among the data. type customer = record name: string; street: string; city: integer; end; • View level: application programs hide details of data types. Views can also hide information (e.g. salary) for security purposes.
  • 10. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Instances and Schemas • Similar to types and variables in programming languages • Schema – the logical structure of the database (e.g., set of customers and accounts and the relationship between them) • Instance – the actual content of the database at a particular point in time
  • 11. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Data Independence • Ability to modify a schema definition in one level without affecting a schema definition in the other levels. • The interfaces between the various levels and components should be well defined so that changes in some parts do not seriously influence others. • Two levels of data independence – Physical data independence – Logical data independence
  • 12. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Data Models • A collection of tools for describing: – Data – Data relationships – Data semantics – Data constraints • Object-based logical models – Entity-relationship model – Object-oriented model – Semantic model – Functional model • Record-based logical models – Relational model (e.g., SQL/DS, DB2) – Network model
  • 13. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Distributed Databases Database Distributed System • Distributed database is a database that is not stored in its entirety at a single physical location, but rather is spread across a network of computer.
  • 14. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Distributed Databases • Advantages: – efficiency of local processing – data sharing • Disadvantages: – communication overhead – implementation difficulties
  • 15. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Data Definition Language (DDL) • Specification notation for defining the database schema • DDL compiler generates a set of tables stored in a data dictionary • Data dictionary contains metadata (data about data) • Data storage and definition language – special type of DDL in which the storage structure and access methods used by the database system are specified.
  • 16. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Data Manipulation Language (DML) • Language for accessing and manipulating the data organized by the appropriate data model • Two classes of languages – Procedural – user specifies what data is required and how to get those data – Nonprocedural – user specifies what data is required without specifying how to get those data
  • 17. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Transaction Management • A transaction is a collection of operations that performs a single logical function in a database application. • Transaction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.g. power failures and operating system crashes) and transaction failures. • Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database.
  • 18. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Storage Management • A storage manager is a program module that provides the 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 the following tasks: – Interaction with the file manager – Efficient storing, retrieving, and updating of data
  • 19. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Database Administrator • Coordinates all the activities of the database system; the database administrator has a good understanding of the enterprise’s information resources and needs: • Database administrator’s duties include: – Schema definition – Storage structure and access method definition – Schema and physical organization modification – Granting user authority to access the database – Specifying integrity constraints – Acting as liaison with users – Monitoring performance and responding to changes in requirements
  • 20. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Semester: Second Semester Name of the Subject: DATABASE MANAGEMENT SYSTEM INTRODUCTION TO SQL UNIT-II
  • 21. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) History of SQL • SQL: Structured Query Language • SQL is based on the relational tuple calculus • SEQUEL: Structured English QUEry Language; part of SYSTEM R, 1974 • SQL/86: ANSI & ISO standard • SQL/89: ANSI & ISO standard • SQL/92 or SQL2: ANSI & ISO standard • SQL3: in the works.
  • 22. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) SQL SQL consists of the following parts: • Data Definition Language (DDL) • Interactive Data Manipulation Language (Interactive DML) • Embedded Data Manipulation Language (Embedded DML) • Views • Integrity
  • 23. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Objectives • Explore basic commands and functions of SQL • How to use SQL for data administration (to create tables, indexes, and views) • How to use SQL for data manipulation (to add, modify, delete, and retrieve data) • How to use SQL to query a database to extract useful information
  • 24. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Introduction to SQL • SQL functions fit into two broad categories: – Data definition language • SQL includes commands to: – Create database objects, such as tables, indexes, and views – Define access rights to those database objects – Data manipulation language • Includes commands to insert, update, delete, and retrieve data within database tables
  • 25. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) • SQL is relatively easy to learn • Basic command set has vocabulary of less than 100 words • Nonprocedural language • American National Standards Institute (ANSI) prescribes a standard SQL • Several SQL dialects exist
  • 26. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Introduction to SQL
  • 27. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Introduction to SQL (continued)
  • 28. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Introduction to SQL (continued)
  • 29. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Data Definition Commands • Examine simple database model and database tables that will form basis for many SQL examples • Understand data environment
  • 30. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) The Database Model
  • 31. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Creating the Database • Following two tasks must be completed: – Create database structure – Create tables that will hold end-user data • First task: – RDBMS creates physical files that will hold database – Tends to differ substantially from one RDBMS to another
  • 32. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) The Database Schema • Authentication – Process through which DBMS verifies that only registered users are able to access database – Log on to RDBMS using user ID and password created by database administrator • Schema – Group of database objects—such as tables and indexes—that are related to each other
  • 33. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Data Types • Data type selection is usually dictated by nature of data and by intended use • Pay close attention to expected use of attributes for sorting and data retrieval purposes
  • 34. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Data Types (continued)
  • 35. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Creating Table Structures • Use one line per column (attribute) definition • Use spaces to line up attribute characteristics and constraints • Table and attribute names are capitalized • NOT NULL specification • UNIQUE specification
  • 36. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) SQL Constraints • NOT NULL constraint – Ensures that column does not accept nulls • UNIQUE constraint – Ensures that all values in column are unique • DEFAULT constraint – Assigns value to attribute when a new row is added to table • CHECK constraint – Validates data when attribute value is entered
  • 37. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) SQL Indexes • When primary key is declared, DBMS automatically creates unique index • Often need additional indexes • Using CREATE INDEX command, SQL indexes can be created on basis of any selected attribute • Composite index – Index based on two or more attributes – Often used to prevent data duplication
  • 38. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Summary • Many SQL constraints can be used with columns. • The column list represents one or more column names separated by commas. • WHERE clause can be used with SELECT, UPDATE, and DELETE statements to restrict rows affected by the DDL command.
  • 39. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Semester: SECOND Semester Name of the Subject: DBMS RELATIONAL DATA MODEL UNIT-III
  • 40. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Relational Data Model • In the relational data model the database is represented as a group of related tables. • The relational data model was introduced in 1970 by E. F. Codd of IBM published a paper in CACM entitled "A Relational Model of Data for Large Shared Data Banks". • It is currently the most popular model. The mathematical simplicity and ease of visualization of the relational data model have contributed to its success.
  • 41. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Definitions of Terminology Formal relational term Informal equivalents relation table tuple row or record cardinality number of rows attribute column or field degree number of columns (unique) identifier Primary key domain pool of legal values
  • 42. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Characteristics of a Relation (table) • Two-dimensional structure with rows and columns • A relation represent a single entity • Each table must have an attribute to uniquely identify each row • Column values all have same data type • Order of the rows and columns is immaterial to the DBMS
  • 43. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Properties of a Relation • Based on the set theory • 1. There are no duplicate tuples (rows). – The body of the relation is a mathematical set (i.e., a set of tuples), and sets in mathematics by definition do not include duplicate elements. – If a "relation" contains duplicate tuples, then it is not a relation.
  • 44. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Properties of a Relation • 2. Tuples (rows) are unordered (top to bottom). – Sets in mathematics are not ordered. So, even if a relation A's tuples are reversely ordered, it is still the same relation. – Thus, there is no such thing as "the 5th tuple" or the last tuple. In other words, there is no concept of positional addressing.
  • 45. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Properties of a Relation • Based on the set theory • 1. There are no duplicate tuples (rows). – The body of the relation is a mathematical set (i.e., a set of tuples), and sets in mathematics by definition do not include duplicate elements. – If a "relation" contains duplicate tuples, then it is not a relation.
  • 46. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Properties of a Relation 4. All attribute values are atomic. – At every row-and-column position within the table, there always exists precisely one value, never a list of values. Or equivalently, relations do not contain repeating groups. – A relation satisfying this condition is said to be in First Normal Form.
  • 47. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Primary Key • A PK is an attribute, or collection of attributes, whose values uniquely identify each tuple in a relation. • To being unique, a PK must be minimal (contain no unnecessary attributes) • and must not change in value.
  • 48. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Entity Integrity Rule • Guarantees that each entity will have a unique identity and ensures that foreign key values can properly reference primary key values. • Requirement – No component of the primary key is allowed to accept nulls. – By "null" here, we mean that information is missing for some reason.
  • 49. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Foreign Key • An attribute in one table whose values must either match the primary key in another table or be null. • Attribute FK of base relation R2 is a foreign key if and only if it satisfies the following two time-independent properties: – Each value of FK is either wholly null or wholly non-null. – Each non-null value of FK is identical to the value of PK in some tuple of R1.
  • 50. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Referential Integrity Rule • The database must not contain any unmatched foreign key values. • Just as primary key values represent entity identifiers, so foreign key values represent entity references. • The referential integrity rule simply says that if B references A, then A must exist.
  • 51. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Select Operation • Notation:  p(r) lowercase Greek sigma  • p is called the selection predicate • Defined as: p(r) = {t | t  r and p(t)} Where p is a formula in propositional calculus consisting of terms connected by :  (and),  (or),  (not) Each term is one of: <attribute> op <attribute> or <constant> where op is one of: =, , >, . <. 
  • 52. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Union Operation • Notation: r  s • Defined as: r  s = {t | t  r or t  s} For r  s to be valid. 1. r, s must have the same arity (same number of attributes) 2. The attribute domains must be compatible (e.g., 2nd column of r deals with the same type of values as does the 2nd column of s). Although the field types must be the same, the names can be different. For example I can union professor and lecturer where:
  • 53. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) The Data Normalization Process • A methodology for organizing attributes into tables so that redundancy among the nonkey attributes is eliminated. • The output of the data normalization process is a properly structured relational database.
  • 54. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) The Data Normalization Technique • Input: – all the attributes that must be incorporated into the database – a list of all the defining associations between the attributes (i.e., the functional dependencies). • a means of expressing that the value of one particular attribute is associated with a single, specific value of another attribute. • If we know that one of these attributes has a particular value, then the other attribute must have some other value.
  • 55. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Full Functional dependency: • If A and B are attributes(columns)of a table, B is fully functionally dependent on A if B is functionally dependent on A, but not on any proper subset of A. SalesPerson#--SalesPersonName •Partial Functional Dependency: • If A and B are attributes of a table, B is partially dependent on A if there is some attribute that can be removed from A and yet the dependency still holds. SP#, SPName -------> Comm% •Transitive Functional Dependency: • A , B and C are attributes of a table. If A is functionally dependent on B, and B is functionally dependent on C, then C is Transitively dependent on A via B. .
  • 56. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Logical Design of Relational Database Systems • The conversion of E-R diagrams into relational tables. • The data normalization technique. • The use of the data normalization technique to test the tables resulting from the E- R diagram conversions.
  • 57. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Second Normal Form A Table is said to be in 2NF if it is in 1NF and there are no partial dependencies No Partial Functional Dependencies Every non primary key attribute of the table must be fully functionally dependent on the entire primary key of that table. A non-key attribute cannot depend on only part of the key.
  • 58. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Third Normal Form • A Table that is in 1NF and 2NF and in which no non primary key attribute is transitively dependent on the primary key. • Does not allow transitive dependencies in which one nonkey attribute is functionally dependent on another. • Nonkey attributes are not allowed to define other nonkey attributes. • "Each attribute must be a fact about the key, the whole key, and nothing but the key."
  • 59. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Boyce-codd Normal Form (BCNF) • A Table is in BCNF if and only if every determinant (i.e., the attribute or a group of attributes on which some other attribute is fully functionally dependent) is a candidate key. BCNF is a stronger form of 3NF. • The difference between 3NF and BCNF is that for a Functional dependency A--->B, 3NF allows this dependency in a table if attribute B is a primary key attribute and attribute A is not a candidate key, where as BCNF insists that for this dependency to remain in a table, attribute A must be a candidate key.
  • 60. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Semester: SECOND Semester Name of the Subject: DBMS TRANSACTION PROCESSING AND CONCURRENCY CONTROL UNIT-IV
  • 61. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Transaction • Any action that reads from and/or writes to a database may consist of: – Simple SELECT statement to generate list of table contents – Series of related UPDATE statements to change values of attributes in various tables – Series of INSERT statements to add rows to one or more tables – Combination of SELECT, UPDATE, and INSERT statements
  • 62. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) • Transaction is logical unit of work that must be either entirely completed or aborted • Successful transaction changes database from one consistent state to another – One in which all data integrity constraints are satisfied • Most real-world database transactions are formed by two or more database requests – Equivalent of a single SQL statement in an application program or transaction
  • 63. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Evaluating Transaction Results • Not all transactions update database • SQL code represents a transaction because database was accessed • Improper or incomplete transactions can have devastating effect on database integrity – Some DBMSs provide means by which user can define enforceable constraints – Other integrity rules are enforced automatically by the DBMS
  • 64. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) The ACID Properties • Atomicity – Requires that all operations (SQL requests) of a transaction be completed • Consistency – Indicates the permanence of database’s consistent state
  • 65. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) • Isolation – Data used during execution of a transaction cannot be used by second transaction until first one is completed • Durability – Indicates permanence of database’s consistent state Isolation
  • 66. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Transaction Management with SQL • ANSI standards require that, when a transaction sequence is initiated by a user or an application program, it must continue through all succeeding SQL statements until one of four events occurs – COMMIT statement is reached – ROLLBACK statement is reached – Program is abnormally terminated
  • 67. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Concurrency Control • Coordination of simultaneous transaction execution in a multiprocessing database system • Objective is to ensure serializability of transactions in a multiuser database environment
  • 68. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Scheduling Algorithms • Modify concurrency control schemes for use in distributed environment. There are 3 basic methods for transaction concurrency control. • Locking (two phase locking - 2PL). • Timestamp ordering • Optimistic • Hybrid
  • 69. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Locking Protocols • Majority Protocol • Local lock manager at each site administers lock and unlock requests for data items stored at that site. • When a transaction wishes to lock an un replicated data item Q residing at site Si, a message is sent to Si ‘s lock manager. • If Q is locked in an incompatible mode, then the request is delayed until it can be granted. • When the lock request can be granted, the lock manager sends a message back to the initiator indicating that the lock request has been granted.
  • 70. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Timestamp Ordering • Timestamp (TS): a number associated with each transaction – Not necessarily real time • Can be assigned by a logical counter – Unique for each transaction – Should be assigned in an increasing order for each new transaction
  • 71. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Concurrency Control with Locking Methods • Lock – Guarantees exclusive use of a data item to a current transaction – Required to prevent another transaction from reading inconsistent data • Lock manager – Responsible for assigning and policing the locks used by transactions
  • 72. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Lock Granularity • Indicates level of lock use • Locking can take place at following levels: – Database – Table – Page – Row – Field (attribute)
  • 73. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Lock Types • Binary lock – Has only two states: locked (1) or unlocked (0) • Exclusive lock – Access is specifically reserved for transaction that locked object – Must be used when potential for conflict exists • Shared lock – Concurrent transactions are granted Read access on basis of a common lock
  • 74. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Serializability Challenges Given a set of transactions that execute concurrently, the goal is: • to find a schedule equivalent to some serial order • maximize throughput and concurrency Thus, exclude the trivial solution of running transactions one at a time. But, theory is not perfect: • given an arbitrary mix of reads and writes from different transactions, finding out all possible serializable orders is NP-complete.
  • 75. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Serializability Given all the reads and writes from all active transactions, a scheduling of these operations is serializable if the schedule produces the same effect on the database as some serial execution of the same transactions. Why does it help? By definition, a serial execution of transactions does not have any concurrency control problem, since each transaction executes to completion before the next one is allowed to start If we can find a serializable schedule, then the isolation property is satisfied.
  • 76. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Concurrency Control with Time Stamping Methods • Assigns global unique time stamp to each transaction • Produces explicit order in which transactions are submitted to DBMS • Uniqueness – Ensures that no equal time stamp values can exist • Monotonicity – Ensures that time stamp values always increase
  • 77. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Wait/Die and Wound/Wait Schemes • Wait/die – Older transaction waits and younger is rolled back and rescheduled • Wound/wait – Older transaction rolls back younger transaction and reschedules it
  • 78. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Lock-Based Concurrency Control • A DBMS ensures that only serializable schedules are allowed by using a suitable CC protocol. • Strict Two-phase Locking (Strict 2PL) Protocol • Strict 2PL does however allow deadlocks, i.e. cycles of transactions waiting for locks to be released. A DBMS must either prevent or detect (and resolve) deadlocks.
  • 79. Chanderprabhu Jain College of Higher Studies & School of Law Plot No. OCF, Sector A-8, Narela, New Delhi – 110040 (Affiliated to Guru Gobind Singh Indraprastha University and Approved by Govt of NCT of Delhi & Bar Council of India) Summary • Concurrency control and recovery are among the most important functions provided by a DBMS. • Users need not worry about concurrency. – System automatically inserts lock/unlock requests and schedules actions of different Xacts in such a way as to ensure that the resulting execution is equivalent to executing the Xacts one after the other in some order. • Write-ahead logging (WAL) is used to undo the actions of aborted transactions and to restore the system to a consistent state after a crash. – Consistent state: Only the effects of commited Xacts seen.