Please clear this confusion regarding relational algebra/tuple relational calculus -
1: explanation given query "the set of tuples t such there exists tuple s in relation borrow values of t , s cname attribute equal, , value of s amount attribute greater 1200". never mentioned relation t belongs. relation it, , why?
2: in underlying image, "and"ing 2 projections (containing attribute "customerid" "customer" relation & attribute "orderid" "order" relation) give cartesian product of these 2 one-column relations?
1:
tuple t, appearing on left hand side, tuple of the answer. { t | ...t... } means "the set of every value, t say, such ...t... true". each tuple value refer t , if satisfies condition goes in answer.
2:
in part 1 "∧" used connective , in predicate logic expression in relational tuple calculus query. here in 2 using between 2 relation expressions relational algebra operator. "⋈" used natural join , "⨯" used cartesian product (aka cross join). there's natural join operator , if used no common attributes use/value called cartesian product.
those 2 different kinds of expression. "∧" used in both, although different things. isn't problem because between 2 predicate logic expressions it's , and between 2 relational algebra expressions it's relational algebra operator. expect natural join. haven't seen used cartesian product, remember natural join no common attributes is/returns "cartesian product". example "give cartesian product of these two".
some relational algebra variants have tuples unordered unique attribute names. typically cartesian product takes 2 relations don't have attributes in common , returns natural join. since attribute names of tuple t in calculus example aren't given order, maybe it's kind of relation.
some relational algebra variants have ordered tuples attribute names can appear multiple times. typically cartesian product returns tuples common attribute names appearing multiple times. seems case in the slides textbook silberschatz, korth & sudarshan. (which uses "∧" and.) natural join has 1 copy of common attributes cartesian join has two, can differ. in example 2 projection results have disjoint attribute sets. natural join , cartesian product return same relation. (assuming attribute order same.)
[the reason same symbol used , and natural join (and used cartesian product) if relational algebra expression r holds tuples r(...) , relational algebra expression s holds tuples s(...) r natural join s holds tuples r(...) , s(...). in fact every relational algebra expression value of corresponding relational calculus expression relation names correspond given predicates (meanings) , logic operators correspond relation operators.]
use relations, operators , symbols have been told use instructor/textbook. if in doubt define symbols or use words.
Comments
Post a Comment