Suppliers(Sid,Sname,rating) ------> (sid) is key
Parts(Pid,Pname,color) ------> (pid) is key
Catalog(sid,pid,cost) ------> (sid,pid) is key
1) Retrieve sid's supplied only RED parts
it means the suppliers didn't supply atleast one non-red parts ===> ( total red suppliers ) - ( total non-red suppliers )
πsid ( Catalog ⊠ catalog.pid = Parts.pid ( σcolor = 'red' ( Parts ) ) ) - πsid ( Catalog ⊠ catalog.pid = Parts.pid ( σcolor ≠ 'red' ( Parts ) ) )
2) Retrieve sid's supplied EVERY RED part
it means sid's who supplied every RED parts ===> when EVERY ( ALL ) term encounter, use DIVISION operator in RA
πCatalog.sid,P.color ( Catalog ⊠ Catalog.pid = Parts.pid ( Parts ) ) ) / πParts.pid ( ( σcolor = 'red' ( Parts ) ) )
3) Retrieve sid's supplied EVERY RED part or EVERY green part
Union the RED and Green
( πCatalog.sid,P.color ( Catalog ⊠ Catalog.pid = Parts.pid ( Parts ) ) ) / πParts.pid ( ( σcolor = 'red' ( Parts ) ) ) )
∪
( πCatalog.sid,P.color ( Catalog ⊠ Catalog.pid = Parts.pid ( Parts ) ) ) / πParts.pid ( ( σcolor = 'green' ( Parts ) ) ) )
4) Retrieve sid's supplied EVERY RED part but not ANY GREEN part
Set difference of All RED and ANY Green
( πCatalog.sid,P.color ( Catalog ⊠ Catalog.pid = Parts.pid ( Parts ) ) ) / πParts.pid ( ( σcolor = 'red' ( Parts ) ) ) )
-
( πCatalog.sid ( Catalog ⊠ Catalog.pid = Parts.pid ( σcolor = 'green' ( Parts ) ) ) )