Final EST Solution
Final EST Solution
1a
1(b) {B→D, BD→E, F→J, F→B, F→E}
{BD→E}
{B}+ = {B,D}
D is extra and is removed.
{B→E}
2(a) It is a method of concurrency control in DBMS that ensures serializability by applying a lock
to the transaction data which blocks other transactions to access the same data simultaneously.
Two Phase Locking protocol helps to eliminate the concurrency problem in DBMS.
• This locking protocol divides the execution phase of a transaction into three different
parts.
• In the first phase, when the transaction begins to execute, it requires permission for
the locks it needs.
• The second part is where the transaction obtains all the locks. When a transaction
releases its first lock, the third phase starts.
• In this third phase, the transaction cannot demand any new locks. Instead, it only
releases the acquired locks. [2
Marks]
because of Dirty Read in T2 and T3 in lines 8 and 12 respectively, when T1 failed we have to
roll back others also. Hence, Cascading Rollbacks are possible in 2-PL.
2 marks
2(b) 1 mark for each =1x3=3
i) ii) iii)
Schedule S2 S2:
T1 T2 T1 T2
--------------------- r2(x)
r1(X) r2(y)
r2(X) w2(y)
r2(Y) r1(x)
w2(Y) r1(y)
r1(Y) w1(x)
w1(X)
S1 emp.salary%type;
Begin
Select salary into S1 from emp where emp_id=Ecode;
return S1; (1 marks, -0.5 for return )
exception
When No_Data_Found then (1 marks)
return -1; (-0.5)
End c_sal;
Declare (1 mark)
eid number(4);
Sal number(10,4);
begin
eid:=&entereid;
Sal:=calc_sal(eid); or Sal:= calc_sal(23);
Dbms_output.put_line('salary of an employee '||Sal);
end;
Note: -0.5 for nesting function for local function block
4(b) Three Anomalies Insert delete and update with examples (3x1(0.5 for
example+0.5 for explanation)
5(a)
DECLARE
v_emp_rec emp%ROWTYPE;
id emp.emp_id%type;
SELECT *
FROM emp where emp_id not in empno;
OPEN cur_emp_name(id);
LOOP
v_emp_rec.hra:=0.2*v_emp_rec.bp;
v_emp_rec.total:=v_emp_rec.bp+v_emp_rec.da+v_emp_rec.hra;
update emp set total=v_emp_rec.total
where emp_id=v_emp_rec.emp_id;
END LOOP;
CLOSE cur_emp_name;
END;
BEGIN
id:=&id;
p1(id);
END;
END IF;
END;