note5-relationalalgbra

note5-relationalalgbra - CSc134 Organization...

Info icon This preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CSc 134 Database Management and File  Organization 5. Relational Algebra Ying Jin Computer Science Department California state University, Sacramento
Image of page 1

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

View Full Document Right Arrow Icon
2 Relational Algebra A set of operations for the relational model.  Enable a user to specify basic retrieval  requests.  The  algebra operations  produce new  relations. The result of a retrieval is a new relation. A sequence of relational algebra operations  forms a  relational algebra expression result  a relation  represents the result of a database query.
Image of page 2
3 Topics on relational algebra Unary Relational Operations  Select project Relational Algebra Operations From Set  Theory Union, intersection, minus Cartesian product Binary Relational Operations Join equijoin, natural join variations of join Division
Image of page 3

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

View Full Document Right Arrow Icon
4 The SELECT Operation σ   <selection condition>  (R) Filter - only those tuples that satisfy a  qualifying condition appear in the result. Result:  subset  of the tuples  Examples σ   DNO=4 (Employee) σ   (DNO=4 and salary>2500) or (DNO=5 AND salary>3000) (Employee)
Image of page 4
5
Image of page 5

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

View Full Document Right Arrow Icon
6 The SELECT Operation  (Cont.) Commutative σ   <cond1>  ( σ   <cond2>  (R)) =  σ   <cond2>  ( σ   <cond1>  (R)) A cascaded SELECT operation  may be  applied in any order σ <condition1> ( σ < condition2>  ( σ <condition3>  (   R))  σ <condition2>  ( σ < condition3>  ( σ < condition1>  ( R))) Cascade of SELECT operations into a single  SELECT operation σ  <cond1>  ( σ   <cond2>  (… ( σ   <condn> (R))…) =
Image of page 6
7 The Project Operation This operation selects certain  columns  from  the table and discards the other columns. Creates a vertical partitioning –  one with the needed columns (attributes)  containing results of the operation  other containing the discarded Columns. π <list>  ( R 29 Example    π LNAME, FNAME,SALARY (EMPLOYEE)
Image of page 7

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

View Full Document Right Arrow Icon
8 The Project Operation (Cont.) π  removes any duplicate tuples The result of  π  is a set of tuples – a valid  relation π sex, salary (EMPLOYEE)
Image of page 8
Image of page 9
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