relAlg - Relational Algebra Goal: Some operators to...

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

View Full Document Right Arrow Icon
Himanshu Gupta CSE 532 – RelAlg – 1 Relational Algebra Goal: Some operators to “manipulate” tables. Relational operators can be looked as analogous to the arithmetic operators which are used to manipulate numbers.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Himanshu Gupta CSE 532 – RelAlg – 2 Core” Relational Algebra A small set of operators that allow us to manipulate relations in limited but useful ways. The operators are: 1. Union, intersection, and difference: the usual set operators. But the relation schemas must be the same. 2. Selection : Picking certain rows from a relation. 3. Projection : Picking certain columns. 4. Products and joins : Composing relations in useful ways. 5. Renaming of relations and their attributes.
Background image of page 2
Himanshu Gupta CSE 532 – RelAlg – 3 Selection R 1 = σ C ( R 2 ) where C is a condition involving the attributes of relation R 2 . Example Relation Sells : JoeMenu = σ bar =  Joe’s ( Sells ) bar beer price Joe's Bud 2.50 Joe's Miller 2.75 Sue's Bud 2.50 Sue's Coors 3.00 bar beer price Joe's Bud 2.50 Joe's Miller 2.75
Background image of page 3

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

View Full DocumentRight Arrow Icon
Himanshu Gupta CSE 532 – RelAlg – 4 Projection R 1 = π L ( R 2 ) where L is a list of attributes of R 2 . Example π beer,price ( Sells ) Notice elimination of duplicate tuples. beer price Bud 2.50 Miller 2.75 Coors 3.00
Background image of page 4
Himanshu Gupta CSE 532 – RelAlg – 5 Cartesian Product R = R 1 × R 2 pairs each tuple t 1 of R 1 with each tuple t 2 of R 2 and puts in R a tuple t 1 t 2 .
Background image of page 5

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

View Full DocumentRight Arrow Icon
Himanshu Gupta CSE 532 – RelAlg – 6 Theta-Join R = R 1 C R 2 is equivalent to R = σ C ( R 1 × R 2 ).
Background image of page 6
Himanshu Gupta CSE 532 – RelAlg – 7 Example Sells =                                   Bars = BarInfo = Sells Sells.Bar=Bars.Name Bars bar beer price Joe's Bud 2.50 Joe's Miller 2.75 Sue's Bud 2.50 Sue's Coors
Background image of page 7

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

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

This note was uploaded on 12/01/2010 for the course CSE 532 taught by Professor Badr,h during the Spring '08 term at SUNY Stony Brook.

Page1 / 25

relAlg - Relational Algebra Goal: Some operators to...

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

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