Professional Documents
Culture Documents
DBMS Updated Unit 1
DBMS Updated Unit 1
DBMS Updated Unit 1
RCS 501
Data Base Management System
By
Vineet Kumar
Associate Prof. ( CSE) & Dean (SW)
Syllabus
UNIT 1
Introduction: Overview, Database System vs File System,
Database System Concept and Architecture, Data Model
Schema and Instances, Data Independence and Database
Language and Interfaces, Data Definitions Language, DML,
Overall Database Structure. Data Modeling Using the Entity
Relationship Model: ER Model Concepts, Notation for ER
Diagram, Mapping Constraints, Keys, Concepts of Super Key,
Candidate Key, Primary Key, Generalization, Aggregation,
Reduction of an ER Diagrams to Tables, Extended ER Model,
Relationship of Higher Degree.
04/03/2020 Vineet Kumar 3
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Syllabus
UNIT 2
Relational data Model and Language: Relational Data Model
Concepts, Integrity Constraints, Entity Integrity, Referential
Integrity, Keys Constraints, Domain Constraints, Relational
Algebra, Relational Calculus, Tuple and Domain Calculus.
Introduction on SQL: Characteristics of SQL, Advantage of SQL.
SQl Data Type and Literals. Types of SQL Commands. SQL
Operators and Their Procedure. Tables, Views and Indexes.
Queries and Sub Queries. Aggregate Functions. Insert, Update
and Delete Operations, Joins, Unions, Intersection, Minus,
Cursors, Triggers, Procedures in SQL/PL SQL
04/03/2020 Vineet Kumar 4
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Syllabus
UNIT 3
Data Base Design & Normalization: Functional dependencies,
normal forms, first, second, 8 third normal forms, BCNF, inclusion
dependence, loss less join decompositions, normalization using
FD, MVD, and JDs, alternative approaches to database design
UNIT 4
Transaction Processing Concept: Transaction System, Testing of
Serializability, Serializability of Schedules, Conflict & View
Serializable Schedule, Recoverability, Recovery from Transaction
Failures, Log Based Recovery, Checkpoints, Deadlock Handling.
Distributed Database: Distributed Data Storage, Concurrency
04/03/2020 Control, Directory System. Vineet Kumar 5
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Syllabus
UNIT 5
Concurrency Control Techniques: Concurrency Control,
Locking Techniques for Concurrency Control, Time Stamping
Protocols for Concurrency Control, Validation Based Protocol,
Multiple Granularity, Multi Version Schemes, Recovery with
Concurrent Transaction, Case Study of Oracle.
References:
1. Korth, Silbertz, Sudarshan,” Database Concepts”, McGraw Hill
2. Date C J, “An Introduction to Database Systems”, Addision Wesley
3. Elmasri, Navathe, “ Fundamentals of Database Systems”, Addision Wesley
4.Bipin C. Desai, “ An Introduction to Database Systems”, Galgotia
Publications
04/03/2020 Vineet Kumar 6
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Course Objective
Present an introduction to database management
systems, with an emphasis on how to organize,
maintain and retrieve - efficiently, and effectively -
information from a DBMS.
Differentiate between database system and file
system.
Knowledge of the different models like database
modeling, relational, hierarchical and network models.
Explain basic issues of transaction processing and
concurrency control.
04/03/2020 Vineet Kumar 7
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Course Outcomes
[CO1] Differentiate database systems from existing file
systems and describe each in both function and benefit.
Program Outcomes
[PO1] Engineering Knowledge:
Apply the knowledge of mathematics, science, engineering
Fundamentals and an engineering specialization to the solution of
complex engineering problem
Program Outcomes
• [PO 4] Conduct investigations of complex problems
an ability to design and conduct experiments, as well as to analyze
and interpret data using research based knowledge and research
method;
Program Outcomes
• [PO 7] Environment and sustainability
Recognition of the need of professional engineering solution for
societal and environmental development.
• [PO 8] Ethics
Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
Program Outcomes
• [PO 10] Communication
an ability to communicate effectively with a range of audiences by
writing reports, documentation and presentation;
CO-PO Mapping
Correlation levels are taken 1, 2 and 3 as defined below:
1: Slight (Low) 2: Moderate (Medium) 3: Substantial (High)
If there is no correlation, put ‘-’
UNIT 1
Introduction to DBMS
Introduction to DBMS
Good data management is an essential prerequisite to
corporate success.
Data Information
Information Knowledge
Knowledge Judgment
Judgment Decision
Decision Success
Introduction to DBMS
What is Data?
Data : is the raw facts and figures. It is represented with the
help of characters like alphabets(A-Z), digits(0-9) and special
characters (+,-,/,*,<,>,= etc.)
Example : 36 , Ravi,
What is Information ?
Information . Processed data is called information.
it is a set of organized or classified data so that it has
some meaningful values.
Example : Age 36 is information, Name of Person is Ravi
04/03/2020 Vineet Kumar 18
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Introduction to DBMS
What is Data Base?
Database made up of two separate words, i.e. Data and base
means database is a base of data.
Database is a collection of related data organized in a way that
data can be easily accessed, managed and updated.
Introduction to DBMS
What is Data Base Management System?
A software package/ system to facilitate the creation and
maintenance of a computerized database.
Example :
Introduction to DBMS
Database Applications
Banking: all transactions
Airlines: reservations, schedules
Universities: registration, grades
Sales: customers, products, purchases
Manufacturing: production, inventory,
orders, supply chain
Human resources: employee records,
salaries, tax deductions
04/03/2020 Vineet Kumar 21
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Introduction to DBMS
Database Design Steps
1. Requirements Analysis
2. Conceptual Modelling (ER Model)
3. Logical Modelling (Relational Model)
4. Schema Refinement (Normalization)
4.Integration of Data
• When new constraints are added in file processing system, It is difficult to
change the program to enforce them, The problem is compounded when
constraint involve several data item from different files.
Integrity constraints or consistency rules can be applied to database the
constraints is that it applied data item within a single record or the may be
applied to relationships between records.
Database System
Noida Vs. of
Institute File System and
Engineering
Technology Greater Noida
Department of CSE
5.Sharing of Data
In DBMS, data can be shared by authorized users of the organization. The
database administrator manages the data and gives rights to users to
access the data. Many users can be authorized to access the same piece of
information simultaneously. The remote users can also share same data.
Similarly, the data of same database can be shared between different
application programs.
6. Atomicity Problem
In many applications , It is crucial that if failure occur, the data is restored to
the consistent state that existed prior to the failure.
Atomicity means:- either all or not at all.
Database System
Noida
Noida Vs. of
Institute
Institute File
of System and
Engineering
Engineering and
Technology
Technology Greater
Greater Noida
Noida
Department
Department of
of CSE
CSE
Database System Vs. File System
DBMS Advantages over File System :-
7.Control Over Concurrency
In a computer file-based system, if two users are allowed to access data
simultaneously, it is possible that they will interfere with each other. For
example, if both users attempt to perform update operation on the same record,
then one may overwrite the values recorded by the other. Most database
management systems have sub-systems to control the concurrency so that
transactions are always recorded with accuracy.
8.Backup and Recovery Procedures
• In a computer file-based system, the user creates the backup of data regularly to
protect the valuable data from damage due to failures to the computer system
or application program. It is very time consuming method, if amount of data is
large. Most of the DBMSs provide the 'backup and recovery' sub-systems that
automatically create the backup of data and restore data if required.
Database System
Noida Vs. of
Institute File System and
Engineering
Technology Greater Noida
Department of CSE
9.Data Independence
• The separation of data structure of database from the application program
that uses the data is called data independence. In DBMS, you can easily change
the structure of database without modifying the application program.
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Disadvantages of DBMS
DBMS
I. Data
II. Hardware
III. Software
IV. Users
Disadvantage
Noida Of DBMS of Engineering and
Institute
Technology Greater Noida
Department of CSE
Characteristics of DBMS
Data Abstraction
Data Abstraction
We have three level of abstraction
I. Physical level
II. Logical level
III. View Level
Data Abstraction in DBMS
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Abstraction in DBMS
Actors of DBMS
Database Administrator
Database Designers
End Users
Casual End Users
Naïve or parametric End Users
Sophisticated End Users
Stand Alone Users
System Analyst and Application Programmers
Disadvantage
Noida Of DBMS of Engineering and
Institute
Technology Greater Noida
Department of CSE
Data Model
• This model handles more complex applications, such as Geographic Information System
(GIS), scientific experiments, engineering design and manufacturing.
• Example:
Studen ID SName Age Branch Address
Schema andInstitute
Noida Instanceof Engineering and
Technology Greater Noida
Department of CSE
Schema
Introduction to DBMS
• In addition the schema also defines what columns are defined as the
primary key of a table. Understandably, the schema of a database keeps
constant once created, while the actual data in the database tables may
change all the time.
Difference Between Schema and
Noida Institute of Engineering and
Table Technology Greater Noida
Department of CSE
Architecture of DBMS
• There
. are two types of application Architecture of DBMS
1. Two Tire Architecture
2. Three Tire Architecture
Difference Between Schema and
Noida Institute of Engineering and
Table Technology Greater Noida
Department of CSE
Architecture of DBMS
There are two types of application Architecture of DBMS
• 1.
. Two Tire Architecture
2. Three Tire Architecture
Architecture of DBMS
Disadvantages:
• . In two tier architecture application performance will be degrade upon
increasing the users.
Cost-ineffective.
Tightly coupled.
Not easy to scale .
degrades performance when scale.
.
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Architecture of DBMS
• 1. Physical Level
• Physical level describes the physical storage structure of
data in database.
• It is also known as Internal Level.
• This level is very close to physical storage of data.
• At lowest level, it is stored in the form of bits with the
physical addresses on the secondary storage device.
• At highest level, it can be viewed in the form of files.
• The internal schema defines the various stored data types.
It uses a physical data model.
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Architecture of DBMS
• 2. Conceptual Level
• Conceptual level describes the structure of the whole database for a
group of users.
• It is also called as the data model.
• Conceptual schema is a representation of the entire content of the
database.
• These schema contains all the information to build relevant external
records.
• It hides the internal details of physical storage.
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
Architecture of DBMS
• 3. External Level
• External level is related to the data which is viewed by individual end
users.
• This level includes a no. of user views or external schemas.
• This level is closest to the user.
• External view describes the segment of the database that is required
for a particular user group and hides the rest of the database from that
user group.
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
The objective of the three level architecture is to separate each user's view of
the database from the Way the database is physically represented. There
are several reasons why this separation is desirable:
• Each user should be able to access the same data, but have a different
customized view of the data. Each user should be able to change the way
he or she views the data, and this change should not affect other users.
• Users should not have to deal directly with physical database storage
details, such as indexing or hashing. In other words a user's interaction
with the database should be independent of storage considerations
Noida Institute of Engineering and
Technology Greater Noida
Department of CSE
• The DBA should be able to change the conceptual structure of the database
without affecting all users.
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
DBMS Language
1. Data Definition Language (DDL)
2. Data Manipulation Language (DML)
3. Data Control Language (DCL)
4. Transaction Control Language (TCL)
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
GRANT statement
A privilege can either be granted to a User with the help of GRANT
statement.
The privileges assigned can be SELECT, ALTER, DELETE, EXECUTE, INSERT,
INDEX etc.
Revoke Statement
In addition to granting of privileges, you can also revoke (taken back) it by
using REVOKE command.
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
Example
COMMIT command is used to permanent ally save any transaction into
database
ROLLBACK command rollback those changes if they were not committed .
SVEPOINT command used to save temporarily save a transaction.
Noida Institute of Engineering and Technology,
Greater Noida
Department of CSE
Overall database Structure
3. Data Structures
• Following data structures are required as a part of the physical system
implementation.
• Data Files : It stores the database.
• Data Dictionary : It stores meta data (data about data) about the structure of
the database.
• Indices : Provide fast access to data items that hold particular values.
• Statistical Data : It stores statistical information about the data in the
database. This information is used by query processor to select efficient ways to
execute query.
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
Attribute
An entity is represented by a set of attributes. Attribute are unit
that describes the characteristic or properties of entities. In a
database entities are represent by table and attribute by
column.
E.g. attribute name, S.I.N., street, city for ``customer'' entity.
Relationship
Relationships describe the relations between the entities.
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
Types of Attribute
• Simple attribute − Simple attributes are atomic values, which cannot be divided
further. For example, a student's phone number is an atomic value of 10 digits.
• Composite attribute − Composite attributes are made of more than one simple
attribute. For example, a student's complete name may have first_name and
last_name.
• Derived attribute − Derived attributes are the attributes that do not exist in the
physical database, but their values are derived from other attributes present in
the database. For example, average_salary in a department should not be saved
directly in the database, instead it can be derived. For another example, age can
be derived from data_of_birth.
• Single-value attribute − Single-value attributes contain single value. For example
− Social_Security_Number.
• Multi-value attribute − Multi-value attributes may contain more than one
values. For example, a person can have more than one phone number,
email_address, etc.
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
Keys
• Key is an attribute or collection of attributes that uniquely
identifies an entity among entity set.
EXAMPLE: roll no. is key attribute
• TYPES OF KEYS
• Super Key − A set of attributes (one or more) that
collectively identifies an entity in an entity set.
• Candidate Key − A minimal super key is called a candidate
key. An entity set may have more than one candidate key.
• Primary Key − A primary key is one of the candidate keys
chosen by the database designer to uniquely identify the
entity set.
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
Relationship
• The association among entities is called a relationship.
• For example, an employee works_at a department, a student enrolls in a course. Here,
Works_at and Enrolls are called relationships.
• Relationship Set
• A set of relationships of similar type is called a relationship set.
• Degree of Relationship
• The number of participating entities in a relationship defines the degree of the
relationship.
• Binary = degree 2
• Ternary = degree 3
• n-ary = degree n
• Mapping Cardinalities
• Cardinality defines the number of entities in one entity set, which can be
associated with the number of entities of other set via relationship set.
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
Mapping Cardinalities
One-to-one − One entity from entity set A
can be associated with at most one entity of
entity set B and vice versa.
• Owner entity set and weak entity set must participate in a one-to-many relationship
set (one owner, many weak entities).
• Weak entity set must have total participation in this identifying relationship set.
Weak Entity Sets
Specialization
• Top-down design process; we designate subgroupings within an entity
set that are distinctive from other entities in the set.
• These sub groupings become lower-level entity sets that have
attributes or participate in relationships that do not apply to the
higher-level entity set.
• Depicted by a triangle component labeled ISA (E.g. customer “is a”
person).
• Attribute inheritance – a lower-level entity set inherits all the
attributes and relationship participation of the higher-level entity set
to which it is linked.
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
Notation of ER-Diagram
Symbol Shape Name
Entity
Weak Entity
Attribute
Key attribute
Multivalued attribute
Derived attribute
Composi
Composite Attribute te
Noida Institute of Engineering and
Technology Greater Noida
2 Department of CSE
Notation of ER-Diagram
Relationship
Strong relationship
Weak (identifying)
relationship
Problem2
Construct an E-R diagram for a hospital
with a set of patients and a set of
medical doctors. Associate with each
patient a log of the various tests and
examinations conducted.
Problem3
Design an Entity Relationship (ER) model for a college database . Say we
have the following statements.
• A college contains many departments
• Each department can offer any number of courses
• Many instructors can work in a department
• An instructor can work only in one department
• For each department there is a Head
• An instructor can be head of only one department
• Each instructor can take any number of courses
• A course can be taken by only one instructor
• A student can enroll for any number of courses
• Each course can have any number of students
Problem4
Consider a database used to record the
marks that students get in different
exams of different course offerings.
Construct an E-R diagram that models
exams as entities, and uses a
ternary relationship, for the above
database.
04/03/2020 VINEET KUMAR 96
Noida Institute of Engineering and Technology,
Greater Noida
Department of CSE
E-R
ASSIGNMENT EXERCISE
UPS prides itself on having up-to-date information on the processing and current
location of each shipped item. To do this, UPS relies on a company-wide
information system. Shipped items are the heart of the UPS product tracking
information system. Shipped items can be characterized by item number (unique),
weight, dimensions, insurance amount, destination, and final delivery date.
Shipped items are received into the UPS system at a single retail center. Retail
centers are characterized by their type, uniqueID, and address. Shipped items
make their way to their destination via one or more standard UPS transportation
events (i.e., flights, truck deliveries).
These transportation events are characterized by a unique schedule Number, a
type (e.g, flight, truck), and a delivery Route.
Create an Entity Relationship diagram that captures this information about the
UPS system. Be certain to indicate identifiers and cardinality constraints.
1. Generalization
2. Specialization
3. Aggregation
Generalization
Generalization is the process of
extracting common properties from
a set of entities and create a
generalized entity from it.
It is a bottom-up approach in
which two or more entities can be
generalized to a higher level entity if
they have some attributes in
common.
04/03/2020 VINEET KUMAR 101
Generalization
• A bottom-up design process – combine a number of entity sets that
share the same features into a higher-level entity set.
• Specialization and generalization are simple inversions of each other;
they are represented in an E-R diagram in the same way.
• The terms specialization and generalization are used interchangeably.
Noida Institute of Engineering and Technology,
Greater Noida
Department of CSE
Specialization
Specialization is opposite to
Generalization.
It is a top-down approach in which
one higher level entity can be broken
down into two lower level entity.
In specialization, a higher level
entity may not have any lower-level
entity sets, it's possible.
Aggregation
Aggregration is a process when relation between two entities is treated as
a single entity.