Data Mgmt Lab_Part_11

Data Mgmt Lab_Part_11 - 31 Relational Algebra and Calculus...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Relational Algebra and Calculus 31 SELECT S.sid FROM Suppliers S WHERE S.address = ‘221 Packer street’ OR S.sid IN ( SELECT C.sid FROM Parts P, Catalog C WHERE P.color=’red’ AND P.pid = C.pid ) 4. RA ρ ( R 1 sid (( π pid σ color = 0 red 0 Parts ) ./ C a t a l o g )) ρ ( R 2 sid (( π pid σ color = 0 green 0 Parts ) ./ C a t a l o g )) R 1 R 2 TRC { T |∃ T 1 Catalog ( X Parts ( X.color =‘ red 0 X.pid = T 1 .pid ) ∧∃ T 2 Catalog ( Y Parts ( Y.color = 0 green 0 Y.pid = T 2 .pid ) T 2 .sid = T 1 .sid ) T.sid = T 1 .sid ) } DRC {h X i|h X, Y, Z i∈ Catalog ∧∃ A, B, C ( h A, B, C i∈ Parts C = 0 red 0 A = Y ) ∧∃ P, Q, R ( h P, Q, R i∈ Catalog ∧∃ E,F,G ( h E,F,G i∈ Parts G = 0 green 0 E = Q ) P = X ) } SQL SELECT C.sid FROM Parts P, Catalog C WHERE P.color = ‘red’ AND P.pid = C.pid AND EXISTS ( SELECT P2.pid FROM Parts P2, Catalog C2 WHERE P2.color = ‘green’ AND C2.sid = C.sid AND P2.pid = C2.pid )
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Data Mgmt Lab_Part_11 - 31 Relational Algebra and Calculus...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online