What is database? Discuss the importance of DBMS.
Define union compatibility. Given following relations, show the resulting relation of Director ∩ Actor and Actor ∪ Director?
Director
Fname | Lname |
---|---|
Deepak | Giri |
Bhuwan | KC |
Dipendra | Khanel |
Actor
First name | Last name |
---|---|
Deepak | Giri |
Rajesh | Hamal |
Dipendra | Khanel |
How Order By and Group BY Having Clause in SQL are different? Illustrate with suitable examples.
Why normalization is needed? When any relation is said to be in 1NF and 2NF?
How cost of query is measured during query processing? Construct query expression tree for the relational algebra query:
TLFName LName, Address(ODName="Research" ∧ Department Dnumber=Dno (Employee * Works_on))
How wait-for-graph is constructed? How can you use it to detect deadlock in a schedule of transactions? Support your answer with an example.
How read and write operations are performed in a transaction? List the various states where transactions can enter into.
Attempt any TWO questions
[2x10=20]Given the schema as below, write relational algebra and SQL queries for following:
Sailors(sid, sname, rating, age)
Boats(bid, bname, colour)
Reserves(sid, bid, reservedate)
a) Find name, rating and age of all the 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.
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 should 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 relationships in your ER diagram.
b) Convert the ER diagram in Q. 19. a. into equivalent relational tables.
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.