+1 vote
356 views

| 356 views

1
{x1}-{x2}
by Active (2.3k points)
0
Plz explain I'm a bit confused for it to be 0
+1
Part 1
required rows :
p.y=r.y and r.v=v2
so you get
x2 y2 v2

part 2
q.y=r.y and t>2
so you get
x1 y2 v3

these 2 sets don't have any common value of x
therefore you will get the cardinality of 1st
0
This was for how many marks?
+1
2mrk
0
Manisha...r u sure..I also got x1 - x2..
+1 vote

in my gate 2019 paper I have got table data bit different compared to this question. when I solved that question I have got answer as 1. for this particular question answer would be zero only. Please check below.

as operation ∧ is commutative, we better find out R.V=V2 first.σ(P.Y=R.Y ∧ R.V=V2)(P × R)

R.V=V2

 Y V y3 v2 y2 v2

σ(P.Y=R.Y ∧ R.V=V2)(P × R)

 X Y Z V x2 y2 z2 v2 x2 y2 z4 v2

∏x(σ(P.Y=R.Y ∧ R.V=V2)(P × R))

so when we project column x from the above relation we get  (i.e : as no relation should contain duplicate elements)

 X x2

similarly for σ(Q.Y=R.Y ∧ Q.T>2)(Q × R) we get it as below.

Q.T>2

 X Y T x1 y2 5 x2 y1 6

σ(Q.Y=R.Y ∧ Q.T>2)(Q × R)

 X Y T V x1 y2 5 v3 x1 y2 5 v2 x2 y1 6 v1

when we project column x from the above relation we get

X
x1
x2

(i.e : as no relation should contain duplicate elements)

∏x(σ(P.Y=R.Y ∧ R.V=V2)(P × R)) - ∏x(σ(Q.Y=R.Y ∧ Q.T>2)(Q × R))

the final result is {x2} - {x1, x2} it should be nothing

so answer should be 0 for this question.

by (119 points)
edited by