Database Management
Database Management
YEAR OF
CST Database Management CATEGORY L T P CREDIT
INTRODUCTION
204 Systems
PCC 3 1 0 4 2019
Prerequisite: Topics covered under the course Data Structures (CST 201), Exposure to a High
Level Language like C/python.
. I N
Course Outcomes: After the completion of the course the student will be able to
E S
CO1
KTU NOT
Summarize and exemplify fundamental nature and characteristics of database systems
(Cognitive Knowledge Level: Understand)
Model real word scenarios given as informal descriptions, using Entity Relationship
CO2
diagrams. (Cognitive Knowledge Level: Apply)
Model and design solutions for efficiently representing and querying data using
CO3
relational model (Cognitive Knowledge Level: Analyze)
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1
CO2
CO3
CO4
CO5
CO6
PO3
Problem Analysis
KTU
Design/Development of solutions
NOT PO8
PO9
Ethics
Assessment Pattern
Analyze
Evaluate
Create
Mark Distribution
Attendance : 10 marks
E S . I N : 15 marks
NOT
Internal Examination Pattern:
KTU
Each of the two internal examinations has to be conducted out of 50 marks
First Internal Examination shall be preferably conducted after completing the first half of the
syllabus and the Second Internal Examination shall be preferably conducted after completing
remaining part of the syllabus.
There will be two parts: Part A and Part B. Part A contains 5 questions (preferably, 2 questions
each from the completed modules and 1 question from the partly covered module), having 3
marks for each question adding up to 15 marks for part A. Students should answer all questions
from Part A. Part B contains 7 questions (preferably, 3 questions each from the completed
modules and 1 question from the partly covered module), each with 7 marks. Out of the 7
questions in Part B, a student should answer any 5.
There will be two parts; Part A and Part B. Part A contains 10 questions with 2 questions from
each module, having 3 marks for each question. Students should answer all questions. Part B
contains 2 questions from each module of which a student should answer any one. Each question
can have maximum 2 sub-divisions and carries 14 marks.
Syllabus
ER model - Basic concepts, entity set & attributes, notations, Relationships and constraints,
cardinality, participation, notations, weak entities, relationships of degree 3.
E S . I N
KTU NOT
Module 2: Relational Model
Introduction to Relational Algebra - select, project, cartesian product operations, join - Equi-join,
natural join. query examples, introduction to Structured Query Language (SQL), Data Definition
Language (DDL), Table definitions and operations – CREATE, DROP, ALTER, INSERT,
DELETE, UPDATE.
SQL DML (Data Manipulation Language) - SQL queries on single and multiple tables, Nested
queries (correlated and non-correlated), Aggregation and grouping, Views, assertions, Triggers,
SQL data types.
Physical Data Organization - Review of terms: physical and logical records, blocking factor,
pinned and unpinned organization. Heap files, Indexing, Singe level indices, numerical examples,
Multi-level-indices, numerical examples, B-Trees & B+-Trees (structure only, algorithms not
required), Extendible Hashing, Indexing on multiple keys – grid files.
Module 4: Normalization
Different anomalies in designing a database, The idea of normalization, Functional dependency,
Armstrong’s Axioms (proofs not required), Closures and their computation, Equivalence of
Functional Dependencies (FD), Minimal Cover (proofs not required). First Normal Form (1NF),
Second Normal Form (2NF), Third Normal Form (3NF), Boyce Codd Normal Form (BCNF),
Lossless join and dependency preserving decomposition, Algorithms for checking Lossless Join
(LJ) and Dependency Preserving (DP) properties.
E S . I N
KTU NOT
Main characteristics of Column - Family DB (examples from: Cassandra) and Graph DB
(examples from : ArangoDB)
Text Books
2. Sliberschatz A., H. F. Korth and S. Sudarshan, Database System Concepts, 6/e, McGraw
Hill, 2011.
Reference Books:
1. Adam Fowler, NoSQL for Dummies, John Wiley & Sons, 2015
2. NoSQL Data Models: Trends and Challenges (Computer Engineering: Databases and Big
Data), Wiley, 2018
3. Web Resource: https://www.w3resource.com/redis/
4. web Resource: https://www.w3schools.in/category/mongodb/
5. Web Resource: https://www.tutorialspoint.com/cassandra/cassandra_introduction.htm
6. Web Resource : https://www.tutorialspoint.com/arangodb/index.htm
S . I N
team. Each player has a number (unique identifier), name, DoB, start year, and shirt
E
NOT
number that he uses. Teams play matches, in each match there is a host team and a guest
KTU
team.
1. For the SQL query, SELECT A, B FROM R WHERE B=’apple’ AND C = ‘orange’ on the
table R(A, B, C, D), where A is a key, write any three equivalent relational algebra
expressions.
2. Given the FDs P→Q, P→R, QR→S, Q→T, QR→U, PR→U, write the sequence of
Armstrong’s Axioms needed to arrive at the following FDs: (a) P → T (b) PR → S (c)
QR → SU
3. Consider a relation PLAYER (PLAYER-NO, PLAYER-NAME, PLAYER-POSN,
TEAM, TEAM-COLOR, COACH-NO, COACH-NAME, TEAM-CAPTAIN). Assume
that PLAYER-NO is the only key of the relation and that the following dependencies
hold:
TEAM→{TEAM-COLOR, COACH-NO, TEAM-CAPTAIN}
COACH-NO→COACH-NAME.
i. Is the relation in 2NF? If not, decompose to 2NF.
ii. Is the relation in 3NF? If not, decompose to 3NF.
4. In the following tables foreign keys have the same name as primary keys except
DIRECTED-BY, which refers to the primary key ARTIST-ID. Consider only single-
director movies.
MOVIES(MOVIE-ID, MNAME, GENRE, LENGTH, DIRECTED-BY)
ARTIST(ARTIST-ID, ANAME)
ACTING(ARTIST-ID, MOVIE-ID)
Write SQL expressions for the following queries:
(a) Name(s) and director name(s) of movie(s) acted by ‘Jenny’.
(b) Names of actors who have never acted with ‘Rony’
(c) Count of movies genre-wise.
(d) Name(s) of movies with maximum length.
. I N
1. Determine if the following schedule is recoverable. Is the schedule cascade-less? Justify
E S
NOT
your answer. r1(X), r2(Z), r1(Z), r3(X), r3(Y), w1(X), c1, w3(Y), c3, r2(Y), w2(Z), w2(Y),
c2. (Note: ri(X)/wi(X) means transaction Ti issues read/write on item X; ci means
KTU
transaction Ti commits.)
2. Two-phase locking protocol ensures serializability. Justify.
5
Outline the concept of theta-join.
KTU NOT
How is the purpose of where clause is different from that of having clause?
6 What is the use of a trigger?
7 When do you say that a relation is not in 1NF?
8 Given the FDs P→Q, P→R, QR→S, Q→T, QR→U, PR→U, write the sequence of
Armstrong’s Axioms needed to arrive at a. P → T b. PR → S
9 What is meant by the lost update problem?
10 What is meant by check pointing?
PART B
Answer any one Question from each module. Each question carries 14 Marks
11 a. Design an ER diagram for the following scenario: There is a set of teams, each (14)
team has an ID (unique identifier), name, main stadium, and to which city this
team belongs. Each team has many players, and each player belongs to one
team. Each player has a number (unique identifier), name, DoB, start year, and
shirt number that he uses. Teams play matches, in each match there is a host
team and a guest team. The match takes place in the stadium of the host team.
For each match we need to keep track of the following: The date on which the
game is played The final result of the match. The players participated in the
match. For each player, how many goals he scored, whether or not he took
yellow card, and whether or not he took red card. During the match, one player
may substitute another player. We want to capture this substitution and the time
at which it took place. Each match has exactly three referees. For each referee
we have an ID (unique identifier), name, DoB, years of experience. One referee
is the main referee and the other two are assistant referee.
OR
12 a. Interpret the the following ER diagram.
(8)
E S . I N
KTU NOT
"
b. Distinguish between physical data independence and logical data independence (6)
with suitable examples.
OR
14
E S . I N
a.Write SQL DDL statements for the the following (Assume suitable domain (10)
types):
T U N OT
i.
K
Create the tables STUDENT(ROLLNO, NAME, CLASS, SEM,
ADVISER), FACULTY(FID, NAME, SALARY, DEPT). Assume that
ADVISER is a foreign key referring FACUTY table.
ii. Delete department with name ‘CS’ and all employees of the
department.
iii. Increment salary of every faculty by 10%.
b.Illustrate foreign key constraint with a typical example. (4)
15 For the relation schema below, give an expression in SQL for each of the queries (14)
that follows:
a) Find the names, street address, and cities of residence for all employees
who work for the Company ‘RIL Inc.' and earn more than $10,000.
b) Find the names of all employees who live in the same cities as the
companies for which they work.
c) Find the names of all employees who do not work for ‘KYS Inc.’. Assume
that all people work for exactly one company.
d) Find the names of all employees who earn more than every employee of
‘SB Corporation'. Assume that all people work for at most one company.
e) List out number of employees company-wise in the decreasing order of
number of employees.
OR
16
E S . I N (9)
NOT
a. Consider an EMPLOYEE file with 10000 records where each record is of
size 80 bytes. The file is sorted on employee number (15 bytes long), which
KTU
is the primary key. Assuming un-spanned organization and block size of
512 bytes compute the number of block accesses needed for selecting
records based on employee number if,
i. No index is used
ii. Single level primary index is used
iii. Multi-level primary index is used
Assume a block pointer size of 6 bytes.
b. Illustrate correlated and non-correlated nested queries with real examples. (5)
E S . I N
KTU NOT
Teaching Plan
Hours
Course Name
(48)
Module 1: Introduction & ER Model 8
Concept & Overview of DBMS, Characteristics of DB system,
1.1 1
Database Users.
Structured, semi-structured and unstructured data. Data Models and
1.2 1
Schema
E S . I N 1
OT
Module 2: Relational Model
N
7
2.1
K TU
Structure of relational Databases, Integrity Constraints
Synthesizing ER diagram to relational schema, Introduction to
1
2.2 1
relational algebra.
2.3 Relational algebra: select, project, Cartesian product operations 1
2.4 Relational Algebra: join - Equi-join, Natural join 1
2.5 Query examples 1
2.6 Introduction to SQL, important data types 1
DDL, Table definitions and operations – CREATE, DROP, ALTER,
2.7 1
INSERT, DELETE, UPDATE
Module 3: SQL DML, Physical Data Organization 11
3.1 SQL DML, SQL queries on single and multiple tables 1
3.2 Nested queries (correlated and non-correlated) 1
3.3 Aggregation and grouping 1
Hours
Course Name
(48)
3.4 Views, assertions (with examples) 1
3.5 Triggers (with examples), SQL data types 1
Review of terms: physical and logical records, blocking factor,
3.6 1
pinned and unpinned organization. Heap files, Indexing
3.7 Singe level indices, numerical examples 1
E S . I N
NOT
4.2 Functional dependency, Armstrong’s Axioms (proofs not required) 1
KTU
Closures and their computation, Equivalence of FDs, minimal
4.3 1
Cover (proofs not required).
4.4 1NF, 2NF 1
4.5 3NF, BCNF 1
4.6 Lossless join and dependency preserving decomposition 1
Algorithms for checking Lossless Join and Dependency preserving
4.7 1
properties (Lecture 1)
Algorithms for checking Lossless Join and Dependency preserving
4.8 1
properties (Lecture 2)
Module 5: Transactions, Concurrency and Recovery, Recent
14
Topics
5.1 Transaction Processing Concepts: Transaction Model 1
Overview of concurrency control, Significance of concurrency
5.2 1
Control & Recovery
5.3 Transaction States, System Log 1
Hours
Course Name
(48)
5.4 Desirable Properties of transactions, Serial schedules 1
5.5 Concurrent and Serializable Schedules 1
5.6 Conflict equivalence and conflict serializability 1
5.7 Recoverable and cascade-less schedules 1
E S . I N
5.14 NOT
Main characteristics of Column-Family DB (examples from:
KTU
Cassandra) and Graph DB (examples from : ArangoDB) [detailed
study not expected]
1