Dtabase Management System
Dtabase Management System
Candidates are required to answer all the questions in their own words as far as possible.
Group B
Attempt any SIX questions. [6×5=30]
Director Actor
Fname Lname Firstname Lastname
Deepak Giri Deepak Giri
Bhuwan KC Rajesh Hamal
Dipendra Khanal Bhuwan KC
5. How Order By and Group BY Having Clause in SQL are different? Illustrate with suitable
examples. [3+2]
6. Why normalization is needed? When an relation is said to be in 1NF and 2NF? [1+4]
7. How cost of query is measured during query processing? Construct query expression tree for the
relational algebra query; [3+2]
πFName LName, Address(σDName=’’Research” (Department Dnumber=Dno (Employee * Works_on )))
8. How wait-for-graph is constructed? How can you use it to detect deadlock in a schedule of
transactions? Support your answer with and example. [2+2+1]
9. How read and write operations are performed in a transaction? List the various states where
transactions can enter into. [3+2]
Group C
Attempt any TWO questions. [2×10=20]
10. Given the schema as below, write relational algebra and SQL queries for following; [10]
Sailors(sid, sname, rating, age)
Boats(bid, bname, colour)
Reserves(sid, bid, reservedate)
a) Find name, rating and age of all sailors.
b) Find the name and color of boats having color blue.
c) Find name of the boats reserved on date 2021/07/20.
d) Find the names of boats and sailors who have reserved boats having color green.
e) Use Left and Right Outer join between Sailors and Reserves,
11. a) Design an ER diagram of your choice. The ER diagram should contain at least five entities.
Out of those entities, one should be weak entity. Your entities hould have appropriate attributes
including primary key attributes, if any. There should be presence of one to one relationship, one
to many relationship and many to many relationship in your ER diagram.
b) Convert the ER diagram in Q.I.a. into equivalent relational tables.
12. Define stored procedures and triggers. How they are applicable in database? Illustrate with
examples, how can you create before and after triggers on INSERT query. [3+2+5]