Data Mgmt Lab_Part_11

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

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

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 )

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/17/2012 for the course EGN 4302 taught by Professor Dr.vishak during the Fall '12 term at University of Central Florida.

### 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
Ask a homework question - tutors are online