17
Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Pearson Education, Inc.. Chapter 6 The Relational Algebra and Relational Calculus

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Copyright © 2004 Pearson Education, Inc.

Copyright © 2004 Pearson Education, Inc.

Chapter 6

The Relational Algebra and Relational Calculus

Slide 6-3Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE 6.1Results of SELECT and PROJECT operations. (a) (DNO=4 AND

SALARY>25000) OR (DNO=5 AND SLARY>30000)(EMPLOYEE). (b) SEX,

SALARY(EMPLOYEE).

Slide 6-4Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE 6.2Results of a sequence of operations. (a) FNAME, LNAME, SALARY

(DNO=5(EMPLOYEE)). (b) Using intermediate relations and renaming of attributes.

Slide 6-5Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.3Results of the UNION operation RESULT €RESULT1 RESULT2.

Slide 6-6Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.4The set operations UNION, INTERSECTION, and MINUS. (a) Two union-compatible relations. (b) STUDENT INSTRUCTOR. (c) STUDENT INSTRUCTOR. (d) STUDENT – INSTRUCTOR. (e) INSTRUCTOR – STUDENT

Slide 6-7Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.5aThe CARTESIAN PRODUCT (CROSS PRODUCT) operation.

Slide 6-8Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.5bThe CARTESIAN PRODUCT (CROSS PRODUCT) operation.

Slide 6-9Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.5cThe CARTESIAN PRODUCT (CROSS PRODUCT) operation.

Slide 6-10Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.6Result of the JOIN operation DEPT_MGR DEPARTMENT JOIN MGRSSN=SSN EMPLOYEE .

Slide 6-11Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.7Results of two NATURAL JOIN operations. (a) PROJ_DEPT PROJECT * DEPT. (b) DEPT_LOCS DEPARTMENT * DEPT_LOCATIONS.

Slide 6-12Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.8The DIVISION operation. (a) Dividing SSN_PNOS by SMITH_PNOS. (b) T R ÷ S.

Slide 6-13Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.9The AGGREGATE FUNCTION operation.

Slide 6-14Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.10A two-level recursive query.

Slide 6-15Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.11The result of a LEFT OUTER JOIN operation.

Slide 6-16Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.12A relational database schema for a LIBRARY database.

Slide 6-17Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.13A database state for the relations T1 and T2.