1 / 9

Relational Algebra

Relational Algebra. Relational Calculus. 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.

yehuda
Download Presentation

Relational Algebra

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 • SELECTyields values for all attributes found in a table. It yields a horizontal subset of a table. σpredicate (R) • PROJECTproduces a list of all values for selected attributes. It yields a vertical subset of a table. Πa1…an (R) • DIFFERENCEyields 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 PRODUCTproduces 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 • UNIONcombines all rows from two tables. The two tables must be union compatible. R υ S • INTERSECTproduces 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 • JOINallows 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

More Related