Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relational Algebra Relational Calculus. Relational Algebra Operators Relational algebra defines the theoretical way of manipulating table contents using.

Similar presentations


Presentation on theme: "Relational Algebra Relational Calculus. Relational Algebra Operators Relational algebra defines the theoretical way of manipulating table contents using."— Presentation transcript:

1 Relational Algebra Relational Calculus

2 Relational Algebra Operators Relational algebra defines the theoretical way of manipulating table contents using the relational functions Shows HOW Operators SELECT PROJECT JOIN INTERSECT UNION DIFFERENCE PRODUCT DIVIDE

3 Relational Algebra Operators SELECT yields values for all attributes found in a table. It yields a horizontal subset of a table. σ predicate (R) PROJECT produces a list of all values for selected attributes. It yields a vertical subset of a table. Π a1…an (R) DIFFERENCE yields all rows in one table that are not found in the other table; i.e., it subtracts one table from the other. The tables must be union compatible. R - S

4 Relational Algebra Operators A PRODUCT produces a list of all possible pairs of rows from two tables. Default is CARTESIAN PRODUCT R X S Constrain with: A SELECT is performed to yield only the rows for which the common attribute values match. A PROJECT is performed to yield a single copy of each attribute, thereby eliminating duplicate column. DIVIDE requires the use of one single- column table and one two-column table. R÷S

5 Relational Algebra Operators UNION combines all rows from two tables. The two tables must be union compatible. R υ S INTERSECT produces a listing that contains only the rows that appear in both tables. The two tables must be union compatible. R S υ

6 Relational Algebra Operators JOIN allows us to combine information from two or more tables. JOIN is the real power behind the relational database, allowing the use of independent tables linked by common attributes. Theta join R F S = σ F (R X S) Equijoin Function is = Natural join One occurrence of common attribute eliminated. Outer join R S Usually left Semijoin join and project υ

7 Relational Database Software Classification Relational Database Classification

8 Relational Calculus Specifies WHAT is retrieved QBE Predicate calculus – truth value for each proposition Tuple relational calculus Domain relational calculus {x|P(x)}

9 Relational Calculus Well-formed formula –wff And, or, not Quantifiers Existential quantifier Must be true for at least one instance Universal quantifier V True for every instance E


Download ppt "Relational Algebra Relational Calculus. Relational Algebra Operators Relational algebra defines the theoretical way of manipulating table contents using."

Similar presentations


Ads by Google