relational-algebra

relational-algebra - 1 Relational Algebra Basic Operations...

Info iconThis preview shows pages 1–10. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Relational Algebra Basic Operations Algebra of Bags 2 What is an Algebra Mathematical system consisting of: Operands --- variables or values from which new values can be constructed. Operators --- symbols denoting procedures that construct new values from given values. 3 What is Relational Algebra? An algebra whose operands are relations or variables that represent relations. Operators are designed to do the most common things that we need to do with relations in a database. The result is an algebra that can be used as a query language for relations. 4 Core Relational Algebra Union, intersection, and difference . Usual set operations, but both operands must have the same relation schema . Selection : picking certain rows. Projection : picking certain columns. Products and joins : compositions of relations. Renaming of relations and attributes. 5 Selection R1 := C (R2) C is a condition (as in if statements) that refers to attributes of R2. R1 is all those tuples of R2 that satisfy C . 6 Example : Selection Relation Sells: bar beer price Joes Bud 2.50 Joes Miller 2.75 Sues Bud 2.50 Sues Miller 3.00 JoeMenu := bar=Joes (Sells): bar beer price Joes Bud 2.50 Joes Miller 2.75 7 Projection R1 := L (R2) L is a list of attributes from the schema of R2. R1 is constructed by looking at each tuple of R2, extracting the attributes on list L , in the order specified, and creating from those components a tuple for R1. Eliminate duplicate tuples, if any. 8 Example : Projection Relation Sells: bar beer price Joes Bud 2.50 Joes Miller 2.75 Sues Bud 2.50 Sues Miller 3.00 Prices := beer,price (Sells): beer price Bud 2.50 Miller 2.75 Miller 3.00 9 Extended Projection Using the same L operator, we allow the list L to contain arbitrary expressions involving attributes: 1. Arithmetic on attributes, e.g., A + B->C ....
View Full Document

This note was uploaded on 12/13/2011 for the course CSCE 520 taught by Professor Farkas during the Spring '11 term at South Carolina.

Page1 / 40

relational-algebra - 1 Relational Algebra Basic Operations...

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

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