SS ZG518
SS ZG518
Comprehensive Examination
(EC-3 Make-up)
Q.1. Consider the given relational database schema, where the primary keys are underlined.
Give an expression in the relational algebra to express each of the following queries:
[2 + 2 + 2 + 2 + 2 = 10]
person(name, city)
works_for (name, employed_in, salary)
CEO (name, CEO-name, city)
bank (bank-name, city)
(a) Find the names of all employees who earn more than every employee of the bank
B.
(b) Find all banks located in every city in which bank B is located.
(c) Find the bank with the most employees.
(d) Find the bank with the smallest payroll.
(e) Find those banks whose employees earn a higher salary, on average, than the
average salary at bank B.
T1 T2 T3 T4
Read(A)
Read(A)
Read(A)
Write(B)
Write(A)
Read(B)
Write(B)
(a) Write down all the conflicting operations, draw the precedence graph and identify
whether the schedule is conflict-serializable or not. Justify your answer.
(b) Identify whether the schedule is view-serializable or not. Justify your answer.
T1 T2 T3
Read(A)
Read(A)
Read(B)
Write(A)
Read(B)
Write(B)
Read(A)
Q.4. Consider a directed graph G = (V, E) consisting of following edges: {(A, B), (A, C), (B,
D), (B, E), (B, F), (D, G), (D, H), (H, J), (E, I)}. If the scheduler is following graph
based protocol for the concurrency control, then identify the locks those are not permitted
in the above schedule. Justify your answer. [2]
T1 T2 T3 T4
x-lock(B)
x-lock(D)
lock-x(H)
unlock(D)
lock-x(E)
lock-x(D)
unlock-x(B)
unlock-x(E)
lock-x(B)
lock-x(E)
unlock-x(H)
lock-x(B)
unlock-x(D)
lock-x(D)
lock-x(H)
unlock-x(D)
unlock-x(H)
unlock-x(E)
unlock-x(B)
unlock-x(G)
Q.5. On the relational schema r(A,B,C,D,E) following are the functional dependencies:
AB
ABC
DABE
Find the canonical cover. Use this to have dependency preserving-lossless join
decomposition of relation into 3NF. [5]
Q.6. Figure 1 shows the incorrect ER representation of organization schema. The cardinality,
participation and other characteristics of entity/relationship sets are incorrect and
incomplete. Answer the following questions based on the text provided in the question.
[1+1+0.5+1+0.5+1+1+1+1+2=10]
(a) Many employees can be related to one department but each employee must be related to
only one single department. All employees must be related to at least one department and
all departments must have at least one employee. Represent the simple ER model with
“Employee”, and “Department” entity sets; and “Emp_Dept” relationship set. (refer figure
1)
(b) An employee is working on a project to supply a customer. Assume employee and
customer pair can work on one single project. The participation of all the entity sets in
“Proj_Emp_Cust” relationship set is partial. Represent the simple ER model with
“Employee”, “Customer” and “Project” entity sets; and “Proj_Emp_Cust” relationship set.
(refer figure 1)
(c) What would be the equivalent reduction of proj_emp_cust relationship set from ER data
model to Relational schema? Clearly underline the primary key of the derived
proj_emp_cust relation. Mention the foreign keys and their reference. (refer figure 1)
(d) Address attribute in “Employee” (so as with “Customer”, and “Supplier”) entity set is
composite attribute having house number, area, and city attributes. Area is also a
composite attribute with area number and area name attributes. phone_number is a
multivalued attribute. Along with the other attributes show pictorially how would you
represent employee entity set in ER model.
(e) Depict the correct pictorial representation of “Project” entity set with ID, name, start_date,
end_date, total_run_time as the attributes in ER model.
(f) There is a relationship (with relationship set “Dept_Proj_Emp_Cust”) between
“Department” with “Employee”, “Project” and “Customer” for the fulfillment of a project.
The new relationship set “Dept_Proj_Emp_Cust” has one attribute report associated. With
the knowledge provided in part (ii) and using Extended ER features represent the
relationship set pictorially.
(g) Reduce the relationship set formed in previous question to a relationship schema. Mention
the primary key of the relation. Also write the foreign keys in relation with complete
reference to relations.
(h) Another entity set “Manager” is related to employee. Managers are employees with their
IDs represented in “Employee” entity set. They have special rooms for them and can share
room with other managers. Represent the “Manager”, and “Employee” entity sets; and
represent the relationship set “Emp_manager” using ER representation.
(i) Reduce the relationship set “Emp_manager” and entity set “Manager” using relational
schema. Remove the redundancy (if any).
(j) We need to represent the “Employee”, “Supplier” and “Customer” entity sets as
specialization of person entity set (with attributes ID, name, address, and contact number).
The extra attribute in employee is salary, in supplier is turnover and for customer entity
set is paying_capacity. Assuming they are overlapping and partial specialization, draw the
ER diagram and write the corresponding relational schema.
Q.7. A B+- tree with space for maximum 4 pointers is built by 10 successive insertions. What
is the maximum number of node splitting operations that may take place if we wish to
insert the following 9, 19, 29, 38, 25, 16, 4, 2, 8, 1? Show each step of the B+ tree
generation. [5]
Q.8. Suppose that we need to create a dynamic hash structure on relational schema “Customer”
with search key as the attribute “customer_name” and the following tuples: [5]
Customer_name h(customer_name)
John 0011 1001 1000 0001 0110 1110 1111 0001
Anna 1011 0110 1110 0001 1010 0101 1101 0101
Williams 1100 0001 1100 1101 0001 1010 0101 0001
Brown 0011 1110 0001 1010 0001 0101 1110 0011
Dan 0111 1001 1111 0000 0101 1010 0011 1001
Suzan 0101 0001 1111 0101 1010 0010 1001 1111
Mary 0110 0001 1111 1001 0101 0001 1000 0011
Assuming the maximum bucket size is 3 tuples, clearly draw the step by step insertion of
the tuples of the Customer relation in the dynamic hash table.
******