Presentation on theme: "Relational Algebra Jermaine Rodney. What is an “Algebra” Mathematical system consisting of: Operands --- Variables or values from which new values can."— Presentation transcript:
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.
What is Relational Algebra? An Operators are mathematical functions used to retrieve queries by describing a sequence operations on tables or even databases(schema) involved.
Relational algebra received little attention outside of pure mathematics until the publication of E.F. Codd's relational model of data in 1970. Codd proposed algebra as a basis for database query languages.
Core Relational Algebra The relational algebra uses set union, set difference, and Cartesian product from set theory, but adds additional constraints to these operators.
Constraints For set union and set difference, the two relations involved must be union- compatible—that is, the two relations must have the same set of attributes. Because set intersection can be defined in terms of set difference, the two relations involved in set intersection must also be union-compatible.
Constraints cont. For the Cartesian product to be defined, the two relations involved must have disjoint headers—that is, they must not have a common attribute name.
Core Relational Algebra Selection: picking certain rows. Projection: picking certain columns. Joins: compositions of relations. Renaming of relations and attributes etc.
Renaming The ρ operator gives a new schema to a relation. R1 := ρ R1(A1,...,An) (R2) makes R1 be a relation with attributes A1,...,An and the same tuples as R2. Simplified notation: R1(A1,...,An):= R2.
Example: Renaming Bars( ) R(bar, addr):=Bars R ( ) baraddr Joe’sMaple St. Sue’sRiver RD.