in Databases recategorized by
6,925 views
26 votes
26 votes
Give a relational algebra expression using only the minimum number of operators from $(∪, −)$ which is equivalent to $R$ $∩$ $S.$
in Databases recategorized by
6.9k views

5 Answers

57 votes
57 votes
Best answer

$R-(R-S)$

There is no need to use Union operator here.

Just because they say you can use operators from $(∪, −)$ we don't need to use both of them.

Also they are saying that only the minimum number of operators from (∪, −) which is equivalent to $R ∩ S$.

My expression is Minimal.

edited by

4 Comments

Yes @Deepak Poonia Sir I have edited my comment.

0
0

@Abhrajyoti00

$R \cap S = S – ( R – (R \cup S) ) $ is Incorrect.

$S = S – ( R – (R \cup S) ) .$

1
1
edited by
Oh yes! Thanks sir. Corrected now
0
0
15 votes
15 votes
Answer: R − ((R ∪ S) − S)

Just imagine the Venn diagram in mind.

4 Comments

Can you please say Is it necessary to use both U,-?

Can I represent  R ∩ S=R-(U-S) ?

where U is the universal set.

0
0
You should answer what the question demands. So you have to use only (∪, −) operators with R and S.
2
2

Question says only the minimum number of operators from (∪, −) which is equivalent to R ∩ S. Using union is unnecessary here !

8
8

@
Thanks for this solution

0
0
0 votes
0 votes
p ={(1,1) , (2,2) , (1,2)}

q={(1,2) , (2,10) ,(3,2)}

p ח q = { (1,2) }

p-q={ (1,1) (2,2) }

p-(p-q) = { (1,2) }

so  p-(p-q) = p ח q = { (1,2) }
0 votes
0 votes

An other approach 

((R ∪ S-(R-S))-(S-R))

Related questions