This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Relational algebra operator overview Selection The operator P applied to a relation returns all tuples for which the predicate (or condition) P is true. E.g. Length > 150 Projection The operator A1,A2,...,Ak applied to a relation returns a relation with only the attributes A1, A2, ..., Ak. E.g. Title, Year (Movie) Union If we have two relations R and S, then R S is the relation formed by combining all the tuples of R and S. The relations must be unioncompatible: that is, They have the same schema The matching attributes must have the same domain Intersection If we have two relations R and S that are unioncompatible, R S is the relation that contains all tuples in that are in both R and S. Difference If we have two relations R and S that are unioncompatible, R  S is the relation that contains all tuples in R that are not in S. Cartestian Product If we have two relations R and S, the Cartesian product, R S, is the relation formed by combining every tuple from R with every tuple from S. Conditional Join If we have two relations R and S, the conditional join of R and S, R C S, is the relation obtained by combining every tuple from R with every tuple from S that satisfy the condition C. E.g. Movies Length > 150 && Movies.Year == StarsIn.Year StarsIn Natural Join A natural join R S of relations R and S is one in which we combine every tuple from R with every tuple from S that agree on whatever attributes R and S have in common. E.g. Movies StarsIn Left Outer Join A left outer join R S of relations R and S is a natural join that includes additional tuples in R that did not have matching values in the common attributes of S. Missing values from S are set to null. E.g Movies StarsIn ...
View
Full
Document
This note was uploaded on 04/01/2008 for the course INFO 2300 taught by Professor Williamson during the Spring '08 term at Cornell University (Engineering School).
 Spring '08
 WILLIAMSON

Click to edit the document details