Vous êtes sur la page 1sur 35

Dept.

of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

CONTEN
TS
Syllabus

ACADEMIC DAIRY

Lecture
Plan
Assignm
ents
Importan
t
Question

II B.Tech II Semester
Academic Dairy
for
Database Management
II Systems
II B.Tech

SEMESTE
1. Computer Organization
R

2012-13

Faculty:Mr.J.Shiva Prashanth

2. Database Management Systems


Mr. Pavan Kumar
3. Object Oriented Programming
Syllabus:
4. Environmental
Studies
Database System Applications, data

5.
6.

base System vs File system View of Data Data


Abstraction Instances and Schemas data models the ER Model Relational Model other
Formal
and
Automata
Theory
ModelsLanguages
Database Languages
DDL
DML database
access applications programs data
base users and administrator transaction management data base system structure storage
manager
the Query
Processorof Algorithms
Design
and
Analysis
Objective of the Unit:
Academic DairyEconomics
Handbook II CSE
II SEM
6. Manegerial
and
Financial
1
Accounting

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
Understanding data, information, database and DBMS.
Development and need of DBMS
Understanding architecture of DBMS, People associated with the Database
Necessity and benefits of E-R diagram
Plan of Lecture Delivery:
Topic
No of Hours
Date
Remark
Information, Data,
Database, DBMS, File
01
System
Views, Instances,
Abstraction and Schema
01
Data Models, ER diagrams,
ER Model
01
Relational Model, Other
Models, Database
Languages DDL, DML
01
Tutorial
People associated with the
Database users,
administrators and
developers
Database, DBMS,
Application programs,
Transaction Management
DBMS structure, Storage
Manager
Query Processor, Revision
of Topics
Total

01
01

01
01
01
09

Important Questions
One mark questions and answers:1. what are the main functions of DBA
authorizing users to access the database
coordinating/monitoring its use
acquiring hardware/software resources for upgrades
2. what is meant by data independence
Data independence is the capacity to change the schema at one level of the architecture
without having to change the schema at the next higher level. We distinguish between
logical and physical data independence according to which two adjacent levels are
involved. The former refers to the ability to change the conceptual schema without
Academic Dairy Handbook II CSE II SEM
2

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
changing the external schema. The latter refers to the ability to change the internal
schema without having to change the conceptual.
Logical Data Independence:
The capacity to change the conceptual schema without having to change the external
schemas and their associated application programs.
Physical Data Independence:
The capacity to change the internal schema without having to change the conceptual
schema.
3. what are advantages of views:
Views are virtual (not real but in effect) tables or relations which are based on users
view of particular data base.
4. what is relational schema
Representation of relational database's entities, attributes within those entities,
and relationships between those entities
Represented as DDL or Visually
Example: Employee
Ename, Eid,sal, bdate, hiredate, sex where primary key is underlined
5. what is DDL
DDL means Data Definition Language
Used by the DBA and database designers to specify the conceptual schema of a
database.
In many DBMSs, the DDL is also used to define internal and external schemas
(views).
DDL commands are
CREATE
ALTER
TRUNCATE
6. what is Cartesian product
This operation is used to combine tuples from two relations in a combinatorial
fashion.
Denoted by R(A1, A2, . . ., An) x S(B1, B2, . . ., Bm)
Result is a relation Q with degree n + m attributes:
i. Q(A1, A2, . . ., An, B1, B2, . . ., Bm), in that order.
The resulting relation state has one tuple for each combination of tuplesone
from R and one from S.
Hence, if R has nR tuples (denoted as |R| = nR ), and S has nS tuples, then R x S
will have nR * nS tuples.
The two operands do NOT have to be type compatible
Academic Dairy Handbook II CSE II SEM
3

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
7. what is data model
A data model ---a collection of concepts that can be used to describe the
conceptual/logical structure of a database--- provides the necessary means to achieve this
abstraction.
By structure is meant the data types, relationships, and constraints that should hold for
the data. Most data models also include a set of basic operations for specifying
retrievals/updates.
8. what is data redundancy
Repeating the same data again and again is nothing but redundancy.Data redundancy
(such as tends to occur in the "file processing" approach) leads to wasted storage space,
duplication of effort (when multiple copies of a datum need to be updated), and a higher
likelihood of the introduction of inconsistency.
9. write about Nave users
Naive/Parametric end users: Typically the biggest group of users; frequently
query/update the database using standard canned transactions that have been
carefully programmed and tested in advance. Examples:
ii. bank tellers check account balances, post withdrawals/deposits
iii. reservation clerks for airlines, hotels, etc., check availability of seats/rooms and make
reservations.
iv. shipping clerks (e.g., at UPS) who use buttons, bar code scanners, etc., to update status
of in-transit packages.
10. what is DBMS
Database management system is software of collection of small programs to perform
certain operation on data and manage the data.
Two basic operations performed by the DBMS are:
Management of Data in the Database
Management of Users associated with the database.
11. what is Relational algebra

Relational algebra and relational calculus are formal languages associated


with the relational model.
Informally, relational algebra is a (high-level) procedural language and
relational calculus a non-procedural language.

Relational algebra operations work on one or more relations to define another


relation without changing the original relations.
12. define catalog

Academic Dairy Handbook II CSE II SEM


4

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
system catalog, which contains a description of the structure of each file, the type
and storage format of each field, and the various constraints on the data (i.e.,
conditions that the data must satisfy).
The system catalog is used not only by users (e.g., who need to know the names of
tables and attributes, and sometimes data type information and other things), but also
by the DBMS software, which certainly needs to "know" how the data is
structured/organized in order to interpret it in a manner consistent with that structure.
13. define Data Dictionary
Data dictionary / repository:
Used to store schema descriptions and other information such as design decisions, application
program descriptions, user information, usage standards, contains all information stored in
catalog, but accessed by users rather than dbms.

describes the (logical) structure of the whole database for a community of users. Hides
physical storage details, concentrating upon describing entities, data types, relationships,
user operations, and constraints. Can be described using either high-level or
implementational data model.

Applications:
1) Idea of Format of Data
2) Logical storage of Data
3) Structure of DBMS
Students Expected to Learn:
1) Structure of Data, Database, Database Management Systems
2) Views and Levels of Abstraction
3) Database Languages DDL, DML

Academic Dairy Handbook II CSE II SEM


5

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Unit-II
Syllabus:
History of Database Systems, Database Design and ER diagrams, Beyond ER design entities,
Attributes and Entity Sets, Relationships and Relationship Sets, Additional features of ER model,
Concept Design with ER Model, Conceptual Design for Large Enterprises.
Objectives:
1)
2)
3)
4)

To learn about the ER diagrams


Concepts of Attributes and Entity sets
Relationship and Relationship sets
Learn about the Design issues of a database

Time Table:
Topic
No of Hours
History of DBMS,
01
Database design, ER
design,
Beyond ER design,
01
Entities, Attributes
Entities, Relationship
01
and Relationship sets
Additional Features of
01
ER model
Tutorial
01
Concept design with
01
ER model
Conceptual design for
01
Large
Database
Systems
Total
07
Important Questions:

Date

Previous one mark questions up to first two units:-

14. what are the main functions of DBA


15. what is meant by data independence
Academic Dairy Handbook II CSE II SEM
6

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
16. what are advantages of views
17. what is relational model
18. what is referential integrity
19. what is meant by multivalued attribute
20. what is relational schema
21. what is DDL
22. what is Cartesian product
23. what is integrity constraint
24. what is meta data
25. note on update command
26. what is data model
27. list all types of SQL
28. what is data redundancy
29. write about Nave users
30. what is an weak entity set
31. write about composite attribute
32. define candidate key
33. what is DBMS
34. what is RDBMS
35. what is Relational algebra
36. write the use of multivalued attribute
37. what are sql languages
38. define catalog
39. define Data Dictionary
40. define conceptual schema
41. what is relation ship instance
42. what is key constraint
43. what is foreign key constraint
44. how to represent multivalued attribute in E.R model

Academic Dairy Handbook II CSE II SEM


7

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

previous paper long answer questions


1. Describe the three schema architecture. Why do we need mapping b/w schema levels
2. list the cases in which null values are appropriate with examples
3. differentiate b/w FPS and DBMS
4. design a conceptual data base design for health insurance system
5. compare and contrast Relational model and Hierarchical model
6. explain the basic operations of Relational Algebra with examples
7. Draw and explain the DBMS component modules
8. what are advantages of DBMS
9. explain the difference b/w among entity, entity type and relation ship set
10. what is integrity constraint explain deferent constraints in DBMS
11. what are the functions of DBA
12. write about architecture of DBMS
13. explain about various database users
14. what are various capabilities of DBMS
15. what is the difference b/w logical data independence and physical data independence
16. discuss the the main types of constraints on specialization and generalization
17. what is e-r model .explain the components E-R model
18. what is sql and various types of commands
19. explain about relation model and advantages of rm.
APPLICATIONS:
1) Writing ER Model
2) Design issues of Database

Academic Dairy Handbook II CSE II SEM


8

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
Unit-III
Syllabus:
Introduction to Relational Model Integrity constraint over relations, enforcing integrity
constraints, querying relational data, logical database design, introduction to views,
destroying/altering tables and views.
Relational Algebra Selection and Projection set operations, renaming, joins, divisions, Example
of Algebra overviews, relational calculus, tuple relational calculus, domain relational calculus,
expressive power of algebra and calculus.
Objectives of Unit:
1)
2)
3)
4)

Introduction to Relational Model, Integrity constraints over relations


Querying relational data, logical database design, introduction to views and tables
Relational algebra projection and selection, relational calculus
Domain relational calculus, expressive power of algebra and calculus

Teaching Plan:
Topic
Relational Model,
Integrity Constraints,
Querying relational
model
Logical Database
design, introduction to
views
Destroying/altering
tables
Relational Algebra
Tutorial
Selection and
Projection
Joins, renaming
Tuple relational
Calculus
Domain relational
calculus
Tutorial
Expressive power of
algebra and calculus
Total

No of Hours
01

01
01
01
01
01
02
01
01
01
01
12

Academic Dairy Handbook II CSE II SEM


9

Date

Remark

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Important Questions:
Requirements Analysis
user needs; what must database do?
Conceptual Design
high level description (often done with ER model)
Logical Design
translate ER into DBMS data model(Relational model)
(NOW)Schema Refinement
consistency,normalization
Physical Design
- indexes, disk layout
Security Design
- who accesses what
Good Database Design

no redundancy of FACT (!)


no inconsistency
no insertion, deletion or update anomalies
no information loss
no dependency loss

Informal Design Guidelines for Relational Databases


1. Semantics of the Relation Attributes
2. Redundant Information in Tuples and Update Anomalies
3. Null Values in Tuples
4. Spurious Tuples
1. Semantics of the Relation Attributes
GUIDELINE 1: Informally, each tuple in a relation should represent one entity or
relationship instance. (Applies to individual relations and their attributes).
o Attributes of different entities (EMPLOYEEs, DEPARTMENTs, PROJECTs)
should not be mixed in the same relation
o Only foreign keys should be used to refer to other entities
Academic Dairy Handbook II CSE II SEM
10

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
o Entity and relationship attributes should be kept apart as much as possible.
Design a schema that can be explained easily relation by relation. The semantics of
attributes should be easy to interpret.
2. Redundant Information in Tuples and Update Anomalies
Information is stored redundantly
o Wastes storage
o Causes problems with update anomalies
Insertion anomalies
Deletion anomalies
Modification anomalies
Consider the relation:
EMP_PROJ(Emp#, Proj#, Ename, Pname, No_hours)
Insertion anomalies
Cannot insert a project unless an employee is assigned to it.
Deletion anomalies
a. When a project is deleted, it will result in deleting all the employees who work on
that project.
b. Alternately, if an employee is the sole employee on a project, deleting that
employee would result in deleting the corresponding project.
Modification anomalies
Changing the name of project number P1 from Billing to Customer-Accounting may
cause this update to be made for all 100 employees working on project P1.
GUIDELINE 2:
Design a schema that does not suffer from the insertion, deletion and update
anomalies.
If there are any anomalies present, then note them so that applications can be
made to take them into account.
3. Null Values in Tuples
GUIDELINE 3:
Relations should be designed such that their tuples will have as few NULL values
as possible
Attributes that are NULL frequently could be placed in separate relations (with
the primary key)
Academic Dairy Handbook II CSE II SEM
11

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
Reasons for nulls:
Attribute not applicable or invalid
Attribute value unknown (may exist)
Value known to exist, but unavailable
Applications:
1) Understanding the nature of DBMS
2) Relational Algebra and calculus
Students expected to learn:
Relational Algebra, relational calculus

Academic Dairy Handbook II CSE II SEM


12

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Unit-IV
Syllabus:
Form of Basic SQL query, Examples of basic SQL queries, introduction to nested queries,
correlated nested queries set, comparison operators, aggregate operators, NULL values,
comparison using NULL values, Logical Connectivitys, Impact on SQL constructs, Outer joins,
disallowing NULL values, complex integrity constraints in SQL triggers and active databases.
Objectives:
1)
2)
3)
4)
5)

Learn the basics of SQL query


Concepts of Joins
Aggregate Operators
Comparison operators
NULL values

Lecture delivery plan:


Topic
Form of SQL query,
Examples of basic
SQL
Introduction to Nested
Queries
Comparison
Operators, Aggregate
Operators
Aggregate Operators
Comparison using
NULL values
Tutorial
Logical Connectivity
Impact on SQL
queries, Outer Joins
Complex integrity
constraints, Triggers
Active databases,
revision of the unit
Total

No of Hours Required
01
01
01
01
01
01
01
01
01
01
10

Academic Dairy Handbook II CSE II SEM


13

Date

Remark

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Important Questions:
1. Describe the three schema architecture. Why do we need mapping b/w schema levels
2. list the cases in which null values are appropriate with examples
3. differentiate b/w FPS and DBMS
4. design a conceptual data base design for health insurance system
5. compare and contrast Relational model and Hierarchical model
6. explain the basic operations of Relational Algebra with examples
7. Draw and explain the DBMS component modules
8. what are advantages of DBMS
9. explain the difference b/w among entity, entity type and relation ship set
10. what is integrity constraint explain deferent constraints in DBMS
11. what are the functions of DBA
12. write about architecture of DBMS
13. explain about various database users
14. what are various capabilities of DBMS
15. what is the difference b/w logical data independence and physical data independence
16. discuss the the main types of constraints on specialization and generalization
17. what is e-r model .explain the components E-R model
18. what is sql and various types of commands
19. explain about relation model and advantages of rm.

Academic Dairy Handbook II CSE II SEM


14

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Unit-V
Syllabus:
Schema Refinement Problems caused by redundancy, Decomposition Problems related to
decomposition, reasoning about functional dependency, first, second, third normal forms, boyce
codd normal form, Loseless Join Decomposition, Dependency preserving decomposition,
Schema refinement in Database design, Multi valued dependency, fourth normal form
Objectives:
1) Learning Redundancy, Problems caused by the redundancy
2) Decomposition and the problems caused by the decomposition
3) Normal Forms 1NF,2NF,3NF, BCNF
Lecture Plan:
Topic
Redundancy, Concept
of Redundancy
Decomposition,
concept of
decomposition
Functional
Dependency, 1NF
2NF, 3NF
Tutorial
Lose less join,
dependency
preservation
Multi valued
dependency
4NF
Total

No of Hours required
01
01
01
01
01
01
01
01
08

Academic Dairy Handbook II CSE II SEM


15

Date

Remark

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Important Questions:
Normalization:
The process of decomposing unsatisfactory "bad" relations by breaking up their attributes into
smaller relations
Normalization is used to design a set of relation schemas that is optimal from the point of
view of database updating
Normalization starts from a universal relation schema
1NF
Attributes must be atomic:
they can be chars, ints, strings
they cant be
1. _ tuples
2. _ sets
3. _ relations
4. _ composite
5. _ multivalued
Considered to be part of the definition of relation
Unnormalised Relations
Name
PaperList
SWETHA
EENADU, HINDU,DC
PRASANNA EENADU,VAARTHA,HINDU
This is not ideal. Each person is associated with an unspecified
number of papers. The items in the PaperList column do not have a consistent form.
Generally, RDBMS cant cope with relations like this. Each
entry in a table needs to have a single data item in it.
This is an unnormalised relation.
All RDBMS require relations not to be like this - not to havemultiple values in any column (i.e.
no repeating groups)
Name
SWETHA
SWETHA
SWETHA
PRASANNA
PRASANNA
PRASANNA

PaperList
EENADU
HINDU
DC
HINDU
EENADU
VAARTHA

Academic Dairy Handbook II CSE II SEM


16

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
This clearly contains the same information.
And it has the property that we sought. It is in First Normal
Form (1NF).
A relation is in 1NF if no entry consists of more than one value
(i.e. does not have repeating groups)
So this will be the first requirement in designing our databases:
Obtaining 1NF
1NF is obtained by
Splitting composite attributes

splitting the relation and propagating the primary key to remove multi valued attributes

There are three approaches to removing repeating groups from


unnormalized tables:
1. Removes the repeating groups by entering appropriate data in the empty columns of rows
containing the repeating data.
2. Removes the repeating group by placing the repeating data, along with a copy of the original
key attribute(s), in a separate relation. A primary key is identified for the new relation.
3. By finding maximum possible values for the multi valued attribute and adding that many
attributes to the relation

Example:-

Academic Dairy Handbook II CSE II SEM


17

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

The DEPARTMENT schema is not in 1NF because DLOCATION is not a single valued
attribute.
The relation should be split into two relations. A new relation DEPT_LOCATIONS is
created and the primary key of DEPARTMENT, DNUMBER, becomes an attribute of the
new relation. The primary key of this relation is {DNUMBER, DLOCATION}
Alternative solution: Leave the DLOCATION attribute as it is. Instead, we have one tuple
for each location of a DEPARTMENT. Then, the relation is in 1NF, but redundancy
exists.

A super key of a relation schema R = {A1, A2, ...., An} is a set of attributes S subset-of R
with the property that no two tuples t1 and t2 in any legal relation state r of R will have
t1[S] = t2[S]
A key K is a super key with the additional property that removal of any attribute from K
will cause K not to be a super key any more.
If a relation schema has more than one key, each is called a candidate key.
One of the candidate keys is arbitrarily designated to be the primary key, and the
others are called secondary keys.
A Prime attribute must be a member of some candidate key

Academic Dairy Handbook II CSE II SEM


18

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
A Nonprime attribute is not a prime attributethat is, it is not a member of any
candidate key
Functional Dependencies (FDs)
Definition of FD
Inference Rules for FDs
Equivalence of Sets of FDs
Minimal Sets of FDs
Functional dependency describes the relationship between attributes in a relation.
For example, if A and B are attributes of relation R, and B is
functionally dependent on A ( denoted A B), if each value of
A is associated with exactly one value of B. ( A and B may each
consist of one or more attributes.)

Trivial functional dependency means that the right-hand side is a subset ( not necessarily a
proper subset) of the left- hand side.
Main characteristics of functional dependencies in normalization

Have a one-to-one relationship between attribute(s) on the left- and right- hand side of a
dependency;
hold for all time;
are nontrivial.
A set of all functional dependencies that are implied by a given
set of functional dependencies X is called closure of X, written
X+. A set of inference rule is needed to compute X+ from X.
Inference Rules (RATPUP)
1. Relfexivity:

If B is a subset of A, them A B

2. Augmentation:If A B, then A, C B,C


Academic Dairy Handbook II CSE II SEM
19

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
3. Transitivity: If A B and B C, then A C
4. Projection: If A B,C then A B and A C
5. Union:
If A B and A C, then A B,C
6. psudotransitivity: If A B and C D, then A,C B,
Example:-

F = {SSN {ENAME, BDATE, ADDRESS, DNUMBER},


DNUMBER {DNAME, DMGRSSN}}
From F of above example we can infer:
SSN {DNAME, DMGRSSN},
SSN SSN,
DNUMBER DNAME
Full functional dependency indicates that if A and B are
attributes of a relation, B is fully functionally dependent on A if B is functionally dependent
on A, but not on any proper subset of A.
A functional dependency AB is partially dependent if there is some attributes that can be
removed from A and the dependency still holds.

2NF
Second normal form (2NF) is a relation that is in first normal form and every non--key
attribute is fully functionally dependent on the key.
The normalization of 1NF relations to 2NF involves the removal of partial dependencies. If
a partial dependency exists, we remove the functional dependent attributes from the
relation by placing them in a new relation along with
a copy of their determinant.
Obtaining 2NF
Academic Dairy Handbook II CSE II SEM
20

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
_ If a nonprime attribute is dependent only on a proper part of a key, then we take the given
attribute as well as the key attributes that determine it and move them all to a new relation
_ We can bundle all attributes determined by the same subset of the key as a unit
Transitive dependency
A condition where A, B, and C are attributes of a relation such that
if A B and B C, then C is transitively dependent on A via B
(provided that A is not functionally dependent on B or C).
Third normal form (3NF)
A relation that is in first and second normal form, and in which
no non-primary-key attribute is transitively dependent on the
primary key.
The normalization of 2NF relations to 3NF involves the removal of transitive dependencies by
placing the attribute(s) in a new relation along with a copy of the determinant
3NF
R is in 3NF if and only if
if X A then
_ X is a superkey of R, or
_ A is a key attribute of R
3NF: Alternative Definition
R is in 3NF if every nonprime attribute of R is
fully functionally dependent on every key of R, and
non transitively dependent on every key of R.
Obtaining 3NF
Split off the attributes in the FD that causes trouble and move them, so there are two
relations for each such FD
The determinant of the FD remains in the original relation

Academic Dairy Handbook II CSE II SEM


21

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Boyce-Codd normal form (BCNF)


A relation is in BCNF, if and only if, every determinant is a key.
The difference between 3NF and BCNF is that for a functional
dependency A B, 3NF allows this dependency in a relation
if B is a key attribute and A is not a super key,
where as BCNF insists that for this dependency to remain in a relation, A must be a super key.

Academic Dairy Handbook II CSE II SEM


22

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

BCNF
R is in Boyce-Codd Normal Form iff
if X A then X is a superkey of R
more restrictive than 3NF , preferablehas fewer anomalies
Obtaining BCNF
As usual, split the schema to move the attributes of the troublesome FD to another
relation, leaving its determinant in the original so they remain connected

Academic Dairy Handbook II CSE II SEM


23

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Decomposition:
The process of decomposing the universal relation schema R into a set of
relation schemas D = {R1,R2, , Rm} that will become the relational
database schema by using the functional dependencies.
Attribute preservation condition:
Each attribute in R will appear in at least one relation schema Ri in the
decomposition so that no attributes are lost.
Dependency Preservation Property of a Decomposition:
Definition: Given a set of dependencies F on R, the projection of F on Ri,
denoted by pRi(F) where Ri is a subset of R, is the set of dependencies X g Y in
F+ such that the attributes in X Y are all contained in Ri.
Hence, the projection of F on each relation schema Ri in the decomposition D is
the set of functional dependencies in F+, the closure of F, such that all their leftand right-hand-side attributes are in Ri.
Dependency Preservation Property:
A decomposition D = {R1, R2, ..., Rm} of R is dependency-preserving
with respect to F if the union of the projections of F on each Ri in D is
equivalent
to
F;
that
is
((R1(F)) . . . (Rm(F)))+ = F+
Lossless (Non-additive) Join Property of a Decomposition:
Definition: Lossless join property: a decomposition D = {R1, R2, ..., Rm} of R
has the lossless (nonadditive) join property with respect to the set of
Academic Dairy Handbook II CSE II SEM
24

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
dependencies F on R if, for every relation state r of R that satisfies F, the
following holds, where * is the natural join of all the relations in D:
* ( R1(r), ..., Rm(r)) = r
Multi-valued dependency (MVD)
represents a dependency between attributes (for example, A,
B and C) in a relation, such that for each value of A there is a
set of values for B and a set of value for C. However, the set of
values for B and C are independent of each other.
A multi-valued dependency can be further defined as being
trivial or nontrivial. A MVD A > B in relation R is defined
as being trivial if
B is a subset of A
or
AU B = R
A MVD is defined as being nontrivial if neither of the above two
conditions is satisfied.
Fourth normal form (4NF)
A relation that is in Boyce-Codd normal form and contains
no nontrivial multi-valued dependencies.
A relation schema R is in 4NF with respect to a set of dependencies F (that includes
functional dependencies and multivalued dependencies) if, for every nontrivial
multivalued dependency X >> Y in F+, X is a superkey for R.
Definition:
A join dependency (JD), denoted by JD(R1, R2, ..., Rn), specified on relation schema R,
specifies a constraint on the states r of R.
The constraint states that every legal state r of R should have a non-additive join
decomposition into R1, R2, ..., Rn; that is, for every such r we have

* (R1(r), R2(r), ..., Rn(r)) = r


Note: an MVD is a special case of a JD where n = 2.
A join dependency JD(R1, R2, ..., Rn), specified on relation schema R, is a trivial JD if
one of the relation schemas Ri in JD(R1, R2, ..., Rn) is equal to R.
Fifth normal form (5NF)
Definition:
A relation schema R is in fifth normal form (5NF) (or Project-Join Normal Form
(PJNF)) with respect to a set F of functional, multivalued, and join dependencies if,

Academic Dairy Handbook II CSE II SEM


25

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
for every nontrivial join dependency JD(R1, R2, ..., Rn) in F+ (that is, implied by
F),
every Ri is a superkey of R.

Each normal form is strictly stronger than the previous one


Every 2NF relation is in 1NF
Every 3NF relation is in 2NF
Every BCNF relation is in 3NF
Academic Dairy Handbook II CSE II SEM
26

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
Every 4NF relation is in BCNF
Every 5NF relation is in 4NF
Diagrammatic notation of normal forms:-

Normalization
A technique for producing a set of relations with desirable
properties, given the data requirements of an enterprise
UNF is a table that contains one or more repeating groups
1NF is a relation in which the intersection of each row and column contains one
and only one value
2NF is a relation that is in 1NF and every non-primary-key attribute is fully
functionally dependent on the primary key.
3NF is a relation that is in 1NF, 2NF in which no non-primary-key attribute is
transitively dependent on the primary key
BCNF is a relation in which every determinant is a candidate key
4NF is a relation that is in BCNF and contains no trivial multi-valued
dependency

Academic Dairy Handbook II CSE II SEM


27

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Unit-VI
Syllabus:
Transaction- Transaction Management, Transaction state, Implementation of Atomicity and
durability, Concurrent executions, serializability, recoverability, Implementation of Isolation,
Testing for Serializability, Lock based protocols, Time stamp based protocols, validation based
protocols, multiple granularity
Objective:
1)
2)
3)
4)

Concept of Transaction
ACID properties
Serializability
Locks implementation

Lecture Plan:
Topic
Transaction, Transaction
Management
ACID properties
Atomicity, Durability
Concurrent execution,
Isolation
Locks, Implementation
of Locks
Tutorial
Timestamp based
protocols
Multiple Granularity,
revision
Total

No of Hours
01

Date

Remark

01
01
01
01
01
01
07

Important Questions:
1. What is atomicity property

Atomicity means that a transaction is an atomic unit of processing; it is either performed


in its entirety or not performed at all.
Although a transaction is conceptually atomic, a transaction would usually consist of a
number of steps. It is necessary to make sure that other transactions do not see partial

Academic Dairy Handbook II CSE II SEM


28

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
results of a transaction and therefore either all actions of a transaction are completed or
the transaction has no effect on the database. Therefore a transaction is either completed
successfully or rolled back. This is sometime called all-or-nothing.
2. Define serializability of transactions
Serializability is a given set of interleaved transactions is said to be serializable if and
only if it produces the same results as the serial execution of the same transactions.
3. What is functional dependency
A functional dependency is a property of the semantics of the attributes in a relation. The
semantics indicate how attributes relate to one another, and specify the functional
dependencies between attributes. When a functional dependency is present, the
dependency is specified as a constraint between the attributes.
Consider a relation with attributes A and B, where attribute B is functionally dependent
on attribute A. If we know the value of A and we examine the relation that holds this
dependency, we will find only one value of B in all of the tuples that have a given value
of A, at any moment in time. Note however, that for a given value of B there may be
several different values of A.

In the figure above, A is the determinant of B and B is the consequent of A.


The determinant of a functional dependency is the attribute or group of attributes on the
left-hand side of the arrow in the functional dependency. The consequent of a fd is the
attribute or group of attributes on the right-hand side of the arrow.
4. What is Normalization
The process of decomposing unsatisfactory "bad" relations by breaking up their
attributes into smaller relations.
Normalization is a process of analyzing relation schemas so that the following
can be achieved
1. Minimizing redundancy
2. Minimizing insertion, updating, deletion anomalies
5. What is revoke command
Revoke is a DDL command which is used to disallow the privileges that are granted by
DBA using Grant command.
6. What is Transaction
Def 1: Logical unit of database processing that includes one or more access operations
(read -retrieval, write - insert or update, delete).

Academic Dairy Handbook II CSE II SEM


29

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
Def 2: Transaction is an executing program forming a logical unit of database access
operations that involves one or more database operations (read -retrieval, write - insert or
update, delete).

Transaction boundaries:
o Begin and End transaction.
An application program may contain several transactions separated by the Begin and
End transaction boundaries.
Basic operations are read and write
o read_item(X): Reads a database item named X into a program variable. To
simplify our notation, we assume that the program variable is also named X.
o write_item(X): Writes the value of program variable X into the database item
named X.
7. What is Trigger
Triggers are simply stored procedures that are ran automatically by the database
whenever some event happens.
8. What is the use of serializability
Achieving concurrency by executing no. of transactions at a time
Fast response to the user with correct result
Utilization of recourses efficiently
9. What are transaction primitives
Transaction boundaries are nothing but transaction primitives. They are
Begin Transaction and End Transaction.
10. What is an Assertion
Assertion is nothing but a name given to a set of user defined constraints.
11. What are uses of Transaction
Its all about fast query response time and correctness
DBMS is a multi-user systems
o Many different requests
o Some against same data items
Figure out how to interleave requests to shorten response time while guaranteeing
correct result
o How does DBMS know which actions belong together?
Solution: Group database operations that must be performed together into transactions
o Either execute all operations or none
12. What are Anomalies
Refers to a deviation from the common rule(s), type(s), arrangement(s), or form(s).
The general anomalies are insertion, updation, and deletion anomalies.
13. Define view serializability
View equivalence:
Two schedules are said to be view equivalent if the following three conditions hold:
Academic Dairy Handbook II CSE II SEM
30

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
1. The same set of transactions participates in S and S, and S and S include the
same operations of those transactions.
2. For any operation Ri(X) of Ti in S, if the value of X read by the operation has
been written by an operation Wj(X) of Tj (or if it is the original value of X
before the schedule started), the same condition must hold for the value of X
read by operation Ri(X) of Ti in S.
3. If the operation Wk(Y) of Tk is the last operation to write item Y in S, then
Wk(Y) of Tk must also be the last operation to write item Y in S.
View serializability:
Definition of serializability based on view equivalence.
A schedule is view serializable if it is view equivalent to a serial schedule.
14. What are transaction properties
Atomicity: A transaction is an atomic unit of processing; it is either performed in its
entirety or not performed at all.
Consistency preservation: A correct execution of the transaction must take the
database from one consistent state to another.
Isolation: A transaction should not make its updates visible to other transactions until
it is committed; this property, when enforced strictly, solves the temporary update
problem and makes cascading rollbacks of transactions unnecessary .
Durability or permanency: Once a transaction changes the database and the changes
are committed, these changes must never be lost because of subsequent failure.
15. Define Latches
Locks held for a short duration are called Latches. Latches do not follow concurrency
methods rather than they used to guarantee the physical integrity of a page when that
page being written from the buffer to disk.
16. Define Exclusive lock
Exclusive lock is a lock which specifies that no other transaction can able to access the
data item, except the current transaction which holds it. Generally write lock is called as
Exclusive lock.
17. Define Certify lock
Certify lock is a lock used in multi version concurrency technique to certify that the new
version created during write operation is going to be stored permanently in database.
18. Define Granularity
Granularity means size of data item which may be one of the following
1. A database record
2. A field value of a database record
3. A disk block
4. A whole file
5. The whole database
Academic Dairy Handbook II CSE II SEM
31

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Academic Dairy Handbook II CSE II SEM


32

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions
Unit VII
Syllabus:
Recovery and atomicity Log Based recovery, Recovery with concurrent transaction, buffer
management, failure with loss of non volatile storage, advance recovery systems, remote backup
systems.
Objectives:
1)
2)
3)
4)
5)

Concept of Recovery and atomicity


Log based recovery with concurrent execution
Non volatile storage
Advance recovery systems
Remote back up systems

Lecture Plan:
Topic
Recovery and
Atomicity
Log based recovery
Recovery with
concurrent execution,
buffer management
Failure with loss of
non volatile systems
Tutorial
Advance recovery
systems, remote back
up systems
Total

No of Hours
01

Date

01
01
01
01
01
06

Important Questions:
1)
2)
3)
4)

What is recovery and atomicity


What is recovery with concurrent transaction
Write a note on system crash
Write a note on how to over come non volatile storage devices problem

Academic Dairy Handbook II CSE II SEM


33

Remark

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Unit-VIII
Syllabus:
Data on external storage, File Organization and indexing, cluster indexes, Primary and secondary
indexes, Index data structures, hash based indexing, tree based indexing, comparison of file
indexing, index and performance tuning, intuitions for tree indexing, Indexed sequential access
methods B+ trees, A dynamic index structure
Objective:
1)
2)
3)
4)
5)

Concept of storage of data


File organization and indexing
Hash based indexing, tree based indexing
Comparison of file indexing
Performance tuning, access methods

Lecture Plan:
Topic
Data storage overview
File organization and
indexing
Index data structures,
hash based indexing
Tree based indexing,
index and
performance tuning
Tutorial
Indexed sequential
access methods
Dynamic index trees
Total

No of Hours
01
01

Date

01
01
01
01
01
07

Important Questions:
1)
2)
3)
4)

Define catalog
Define indexing, hash based indexing and tree based indexing
Define B+ trees
What is dynamic indexing

Academic Dairy Handbook II CSE II SEM


34

Remark

Dept. of Computer Science Engineering, School of Engineering,


Anurag Group of Institutions

Academic Dairy Handbook II CSE II SEM


35

Vous aimerez peut-être aussi