relAlg - Relational Algebra Goal Some operators to...

Info icon This 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.
Image of page 1

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

View Full Document Right 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.
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
Image of page 3

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

View Full Document Right 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
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 .
Image of page 5

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

View Full Document Right 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 ).
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 3.00 name addr Joe's Maple St.
Image of page 7

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern