How to solve this kind of database questions? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to solve this kind of database questions?

https://www.sololearn.com/post/178252/?ref=app

19th Nov 2019, 9:52 AM
Preity
Preity - avatar
4 Answers
+ 9
Preity a relation R(AB) is given where A is primary key and B is foreign key refining the same relation R again the table will be created with the both values (a, b) So when table is created with mentioned relation R(AB) the values should be present in table b which are already present table a unless the relation will be proved as wrong ▶Option 1:- (a1, a2), (a2, a3), (a3, a4), (a4, a5) Here by the first input relation the relation R(AB) is proved wrong as first (a1, a2) there is no a2 present in table A so table B contain an entry which is not present in table A so the relation proved wrong, all other input set for this option is same so worked in same way by which this option is incorrect ▶Option 2:- (a1, null), (a2, a1), (a4, a3), (a3, a2) First input set (a1, null) it will be inserted and according to the relation 2nd input set (a2, a1) since in last table value a1 is inserted so table B can contain a1 so this is correct too To be continued......
19th Nov 2019, 10:47 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 7
Preity 3rd input set (a4,a3) as a3 is not present or inserted till now so this value a3 is violating the relation and so by this way this option is wrong too ▶Option 3:- (a1,null), (a2, a1), (a3, a2), (a4, a5) So 1st set (a1,null), both are inserted at initial so no violation of relation 2nd input set (a2, a1), a2 is inserted in table A and a1 which is previously inserted in table a can be inserted now in table b so no violation 3rd input set (a3, a2), a3 inserted in table A and a2 which previously inserted in table a will be inserted in table b so no violation 4th input set (a4, a5) as a5 is not present or inserted till now in table so relation is violate and thus the option is false So at last final answer is none of these option which is option D here is an paper representation for that inputs https://cdn.discordapp.com/attachments/510397129638805537/646302240599965715/IMG-20191115-WA0053.jpg
19th Nov 2019, 10:53 AM
GAWEN STEASY
GAWEN STEASY - avatar
0
~ swim ~ can you help in this?
19th Nov 2019, 10:27 AM
Preity
Preity - avatar
19th Nov 2019, 1:01 PM
Preity
Preity - avatar