Relational Algebra Division -
i'm dealing relational algebra division issue. have following 2 relations:
| b | c b --|---|-- --- 1 | 2 | 3 2 relation r = 1 | 2 | 6 relation t = 4 | 2 | 2 4 | 5 | 6
now i'm doing following operation: r ÷ t
when calculate this, result follows:
| c --|-- 1 | 3 r ÷ t = 1 | 6 4 | 2
for me because division @ tuples in r
present in combination tuples in t
. when use relational algebra calculator, such relax returns
| c --|-- r ÷ t = 4 | 2
where did make mistake? in advance help.
is there can help?
performing division on these schema not understand how operator works. definitions of operator not clear, , operation replaced combination of other operators.
a clear way see how works in case consist on create new instance of r columns ordered defining new schema: (a,c,b). is, making attribute of t appear last attribute in a. in case performing simple division, it's pretty straightforward see result, imagine if had schema r(a,d,b,c) , t(b,d). here attributes of t appear different order in r, , given instances not many tuples make difficult check looking them up.
this might difficult operator defined in relational algebra query involves concepts selection, projection , join. it's complicated put out on words. way of thinking operator, think group on sql. in example means using group attributes a,c - create groups every combination of different values these attributes appear on schema instance. each of these groups have set of values of b associated combinations of values of a, c. if think of values of attribute b in instance of t set, can verify: each group obtained grouping a,c, if set of values of b in t included in set of values of b in r, values of a,c tuple of resulting relation.
i know i'm bit late question i've seen many people confused this. if it's not clear enough, leave reference document wrote explaining more in detail , example, here.
Comments
Post a Comment