# Relational Algebra

Document Sample

```					   Sean Hanson
CS 157B
February 9, 2010
 Relational algebra - A formal system for
manipulating relations.

 Relation – A property that assigns truth values to
combinations (k-tuples (sets))
 Formal System – In this case algebra.

 Similar to Set Algebra but slightly different.
 Relational algebras received little attention until the
publication of E.F. Codd's relational model of data in
1970.

 Published paper while working at
IBM, however IBM was slow to
implement his design until rivals
started implementing them.
 Larry Ellison was inspired by the paper written by
Edgar F. Codd and founded Oracle in 1977.
System R database, also based
on Codd’s theories, and wanted
Oracle to be compatible with it,
by refusing to share System R’s
code.
 A relational database matches data by using common
characteristics found within the data set.

Example: A data set containing all the real-estate
transactions in a town can be grouped by the year the
transaction occurred; or it can be grouped by the sale
price of the transaction; or it can be grouped by the
 SQL - Structured Query Language
 Designed for managing data in relational database
management systems (RDBMS), and originally based
upon Relational Algebra.
 During the 1970s, a group at IBM’s San Jose Research
Laboratory developed the System R relational database
management system. Donald D. Chamberlin and
Raymond F. Boyce of IBM subsequently created the
Structured English Query Language (SEQUEL or SEQL)
to manage data stored in System R.
 Clauses - Which are
constituent components
of statements and queries.
   Expressions - Produce
either scalar values or tables consisting of columns and rows of
data.
   Predicates - Specify conditions that can be evaluated to
boolean truth values and which are used to limit the effects of
statements and queries, or to change program flow.
   Queries - Retrieve data based on specific criteria.
    Statements - Have persistent effect on schemas and data, or
which may control transactions, program flow, connections,
sessions, or diagnostics.
 Difference:
 Which records in TABLE_A do not share A_KEY in
TABLE_B?
 select * from TABLE_A where A_KEY not in (select A_KEY
from TABLE_B)

 Intersection:
 What are the records of TABLE_A that share a KEY with
records of TABLE_B?
 select * from TABLE_A where TABLE_A.KEY in (select
TABLE_B.KEY from TABLE_B)
 http://en.wikipedia.org/wiki/Relational_algebra
 http://en.wikipedia.org/wiki/Edgar_F._Codd
 http://en.wikipedia.org/wiki/SQL