Top Banner
Copyright © 2004 Pearson Education, Inc.
17

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

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Copyright © 2004 Pearson Education, Inc.. Chapter 6 The Relational Algebra and Relational Calculus.

Copyright © 2004 Pearson Education, Inc.

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

Copyright © 2004 Pearson Education, Inc.

Chapter 6

The Relational Algebra and Relational Calculus

Page 3: 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).

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

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.

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

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.

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

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

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

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

Copyright © 2004 Pearson Education, Inc.

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

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

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

Copyright © 2004 Pearson Education, Inc.

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

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

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

Copyright © 2004 Pearson Education, Inc.

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

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

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 .

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

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.

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

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.

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

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

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.9The AGGREGATE FUNCTION operation.

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

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

Copyright © 2004 Pearson Education, Inc.

FIGURE≈6.10A two-level recursive query.

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

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.

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

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.

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

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.