Presentation is loading. Please wait.

Presentation is loading. Please wait.

More Relational Algebra

Similar presentations


Presentation on theme: "More Relational Algebra"— Presentation transcript:

1 More Relational Algebra

2 Set Operations on Relations
CARTESIAN PRODUCT UNION INTERSECTION DIFFERENCE

3 JOIN More flavors SEMIJOIN – OUTERJOIN
“If A and B are tables, then the left-semijoin A|XB, is found by taking the natural join of A and B and then projecting the result onto the attributes of A. The result will be just those tuples of A that participate in the join.” Ricardo, p. 192 Equivalent Examples: Student LEFT-SEMIJOIN Enroll Student |X Enroll 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 LEFT OUTER EQUIJOIN & RIGHT OUTER EQUIJOIN Are variations of the outer equijoin Ricardo p. 194, 1953

4 Terminology For two relations to be union compatible each relation must have the same number of attributes, and the attributes in corresponding columns must come from the same domain.

5 Relation Operations Difference
The difference of two relations is a third relation containing tuples that occur in the first relation but not in the second. The relations must be union compatible A-B is not the same as B-A

6 Relation Operations Union
The union of two relations is formed by adding the tuples from one relation to those of a second relation to produce a third relation. The order in which the tuples appear in the third relation is not important. Duplicate tuples must be eliminated The relations must be union compatible

7 Relation Operations Intersection
The intersection of two relations is a third relation containing the tuples that appear in both the first and the second relation. The relations must be union compatible

8 Relation Definitions

9 Attribute Domains

10 Domain Definitions

11 JUNIOR relation (a) HONOR-STUDENT relation (b)

12 Union of JUNIOR and HONOR-STUDENT relations

13 Summary of Relational Algebra Operations

14

15


Download ppt "More Relational Algebra"

Similar presentations


Ads by Google