edited by
18,248 views
62 votes
62 votes

Consider the following tables $T1$ and $T2.$

$$\overset{T1}{\begin{array}{|c|c|c|} \hline \textbf {P} & \textbf {Q} \\\hline  \text {2} &  \text{2 }\\\hline \text{3} & \text{8} \\\hline \text{7} & \text{3} \\\hline \text{5} & \text{8} \\\hline  \text{6 } &\text{9} \\\hline \text{8} & \text{5} \\\hline \text{9} & \text{8} \\\hline \end{array}}
\qquad \overset{T2}{\begin{array}{|c|c|c|} \hline \textbf {R} & \textbf {S} \\\hline  \text {2} &  \text{2 }\\\hline \text{8} & \text{3} \\\hline \text{3} & \text{2} \\\hline \text{9} & \text{7} \\\hline  \text{5 } &\text{7} \\\hline \text{7} & \text{2}  \\\hline \end{array}}$$

In table $T1$ P is the primary key and Q is the foreign key referencing R in table $T2$ with on-delete cascade and on-update cascade. In table $T2,$ R is the primary key and S is the foreign key referencing P  in table $T1$ with on-delete set NULL and on-update cascade. In order to delete record $\langle 3, 8 \rangle$ from the table $T1,$ the number of additional records that need to be deleted from table $T1$ is _______

edited by

6 Answers

0 votes
0 votes

0 record will be additional deleted.

Since, table T1 has On delete cascade constraint, referenced record <3,8> of table T1 will be deleted and the referencing record <8,3> of table T2 will be deleted.

Since, Table T2 has on delete set Null constraint, when referenced record <8,3> of T2 will be deleted, the referencing records, <5,8> and <9,8> get updated to <5,null> and <9, null>. 

So, no additional record will be deleted from table T1.

–2 votes
–2 votes
When <3 8> is deleted from table 1 .it alerts s
Bcz s is referencing p and 3 is deleted from p so tuple having s value 3 will be deleted from table 2. As T2 uses cascade delete approach .now as tuple <8 3>will be deleted from T2 ..q will get alert about 8 deleted from R ( as q references R) .As T1 uses on delete null policy so it sets null in q row where q value is 8....as tuple <5 8>in T1 has q value 8 so it get updated to ,<5 null>...so no tuple is deleted from T1 and 1 tuple deleted from T2.
Answer:

Related questions

31 votes
31 votes
5 answers
1
Madhav asked Feb 14, 2017
10,837 views
In a B+ Tree , if the search-key value is $8$ bytes long , the block size is $512$ bytes and the pointer size is $2\;\text{B}$ , then the maximum order of the B+ Tree is ...
44 votes
44 votes
3 answers
3
Arjun asked Feb 14, 2017
16,041 views
Consider the following database table named $\text{top_scorer}$.$$\overset{\text{top_scorer}}{\begin{array}{|c|c|c|}\hline\\\textbf{player}& \textbf{country}& \textbf...