427 views
1 votes
1 votes

Given,

Suppliers(sid,sname,rating)

Parts(pid,pname,color)

Catalog(sid,pid,cost)

1.Retrieve sid of the suppliers who supplied some red or some green part.

I did it this way-  {t | ∃c∊Catalog ∃p∊ Parts(c.pid=p.pid ∧ p.color="Red" ∨ p.color="Green" ∧ t.sid=c.sid)}

1 more way to do-- {t | ∃c∊Catalog (∃p∊ Parts( p.color="Red" ∨ p.color="Green"∧ c.pid=p.pid) ∧ t.sid=c.sid)}

I want to verify whether these TRC  queries are correct or not.Also correct me if i am wrong.

Suggest some other ways if possible.

 Also,

2. Retrieve sid of suppliers who supplied at least two parts.

1 Answer

2 votes
2 votes

1.{t.sid |∃t∊Supplier, ∃c∊Catalog ,∃p∊ Parts( p.color="Red" ∨ p.color="Green" ∧c.pid=p.pid ^t.sid=c.sid)}

2.{t.sid |∃t∊Supplier, ∃c∊Catalog,∃p1,p2∊ Parts( p1.pid != p2.pid ∧c.pid=p.pid^ t.sid=c.sid)}

Related questions

0 votes
0 votes
2 answers
2
sh!va asked Jun 25, 2016
2,808 views
Check whether graph with following degrees are possible?I) 6, 6, 6, 6, 3, 3, 2, 2II) 7, 6, 6, 4, 4, 3, 2, 2(How to solve this type of questions? Please explain..)
1 votes
1 votes
0 answers
4
Ayush Upadhyaya asked Nov 28, 2018
428 views
Consider two relation schemas$R(A,B,C)$ and $S(D,E,F)$Give an expression in the tuple relational calculus that is equivalent to each of the following.(a)$\pi_A(r)$ ->$\{t...