Relational Algebra
Relational Algebra
• References:
• Databases Illuminated by Catherine Ricardo,
published by Jones and Bartlett in 2004
• Fundamentals of Relational Databases by Ramon
A. Mata-Toledo and Pauline K. Cushman,
published by McGraw Hill in Schaum’s Outline
Series in 2000
• Database Processing, Fundamentals, Design, and
Implementation, Eighth Edition, by David M.
Kroenke, published by Prentice Hall in 2002
Important Concept
• Relational algebra is similar to high school
algebra except that the variables are tables
not numbers and the results are tables not
numbers.
Definition
• “Relational algebra is a theoretical
language with operators that are applied on
one or two relations to produce another
relation.”
Ricardo p. 181
• Symbolic form
–σ EmpDept = 10 (EMPLOYEE) Mata-Toledo p. 37
PROJECT
• “The PROJECT command also operates on a
single table, but it produces a vertical subset of the
table, extracting the values of specified columns,
eliminating duplicates, and placing the values in
a new table.
• Informal general form:
– PROJECT tableName OVER(colName,…,colName)
[GIVING newTableName] Ricardo p. 183
– OUTERJOIN
• “This operation is an extension of a THETA JOIN, an EQUIJOIN or a NATURAL JOIN
operation.
• When forming any of these joins, any tuple from one of the original tables for which there is
no match in the second table does not enter the result.” Ricardo p. 193