Lecture 06 - Relational Algebra

Lecture 06 - Relational Algebra - The Relational Algebra...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: The Relational Algebra Slide 6- 2 Outline Relational Algebra Unary Relational Operations Relational Algebra Operations From Set Theory Binary Relational Operations Additional Relational Operations Examples of Queries in Relational Algebra Slide 6- 3 Relational Model Operations Relational Model Operations Update Operations Retrieve Operations INSERT MODIFY DELETE RELATIONAL ALGEBRA RELATIONAL CALCULUS Formal Relational Query Languages Two mathematical Query Languages form the basis for “real” languages (e.g. SQL), and for implementation: Relational Algebra : More operational , very useful for representing execution plans. Relational Calculus : Lets users describe what they want, rather than how to compute it. ☛ Understanding Algebra & Calculus is key to understanding SQL, query processing! Slide 6- 5 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 Slide 6- 6 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) 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) Slide 6- 8 Database Schema for COMPANY All examples discussed below refer to the COMPANY DB shown here. Slide 6- 9 The following query results refer to this database state Slide 6- 10 Unary Relational Operators SELECT σ PROJECT π RENAME ρ Slide 6- 11 Unary Relational Operations: SELECT The SELECT operation (denoted by σ (sigma)) is used to select a subset of the tuples from a relation based on a selection condition ....
View Full Document

This note was uploaded on 03/19/2012 for the course CMP 202 taught by Professor Hanem during the Spring '12 term at Cairo University.

Page1 / 70

Lecture 06 - Relational Algebra - The Relational Algebra...

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

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