DBMS Week 8 Chap6.ppt - Copyright u00a9 2007 Ramez Elmasri...

This preview shows page 1 - 10 out of 83 pages.

Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 1
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 6 The Relational Algebra and Calculus
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 3 Chapter Outline Relational Algebra Unary Relational Operations Relational Algebra Operations From Set Theory Binary Relational Operations Additional Relational Operations Examples of Queries in Relational Algebra Relational Calculus Tuple Relational Calculus Domain Relational Calculus Example Database Application (COMPANY) Overview of the QBE language (appendix D)
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 4 Relational Algebra Overview Relational algebra is the basic set of operations for the relational model These operations enable a user to specify basic retrieval requests (or queries ) The result of an operation is a new relation , which may have been formed from one or more input relations This property makes the algebra “closed” (all objects in relational algebra are relations)
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 5 Relational Algebra Overview (continued) The algebra operations thus produce new relations These can be further manipulated using operations of the same algebra A sequence of relational algebra operations forms a relational algebra expression The result of a relational algebra expression is also a relation that represents the result of a database query (or retrieval request)
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 6 Brief History of Origins of Algebra Muhammad ibn Musa al-Khwarizmi (800-847 CE) wrote a book titled al-jabr about arithmetic of variables Book was translated into Latin. Its title (al-jabr) gave Algebra its name. Al-Khwarizmi called variables “shay” “Shay” is Arabic for “thing”. Spanish transliterated “shay” as “xay” (“x” was “sh” in Spain). In time this word was abbreviated as x. Where does the word Algorithm come from? Algorithm originates from “al-Khwarizmi" Reference: PBS ( )
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 7 Relational Algebra Overview Relational Algebra consists of several groups of operations Unary Relational Operations SELECT (symbol: (sigma)) PROJECT (symbol: (pi)) RENAME (symbol: (rho)) Relational Algebra Operations From Set Theory UNION ( ), INTERSECTION ( ), DIFFERENCE (or MINUS, ) CARTESIAN PRODUCT ( x ) Binary Relational Operations JOIN (several variations of JOIN exist) DIVISION Additional Relational Operations OUTER JOINS, OUTER UNION AGGREGATE FUNCTIONS (These compute summary of information: for example, SUM, COUNT, AVG, MIN, MAX)
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 8 Database State for COMPANY All examples discussed below refer to the COMPANY database shown here.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 9 Unary Relational Operations: SELECT The SELECT operation (denoted by (sigma)) is used to select a subset

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture