Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus تنبيه : شرائح العرض.

Similar presentations


Presentation on theme: "Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus تنبيه : شرائح العرض."— Presentation transcript:

1 Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في ذلك. حيث المرجع الاساسي للمادة هي الكتاب المعتمد في وصف المقرر

2 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Slide 6- 2 Database State for COMPANY All examples discussed below refer to the COMPANY database shown here.

3 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Employee Slide 6- 3

4 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Department Slide 6- 4

5 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Project Slide 6- 5

6 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 1 Find the name and address of all employees who work for the ‘Research‘ department. Slide 6- 6

7 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 1 Find the name and address of all employees who work for the ‘Research‘ department. Slide 6- 7 FNAMELNAMEAddress JohnSmith731 Fondren, Houston, TX FranklinWong638 Voss, Houston, TX RameshNarayan975 Fire Oak, Humble, TX JoyceEnglish5631 Rice, Houston, TX

8 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 1 Find the name and address of all employees who work for the ‘Research‘ department. Slide 6- 8 RESEARCH_DEPT   DNAME=’Research’ (DEPARTMENT) RESEARCH_EMPS  (RESEARCH_DEPT Dnumber= DNO EMPLOYEE) RESULT   FNAME, LNAME, ADDRESS (RESEARCH_EMPS)

9 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 2 For every project located in 'Stafford', list the project number, the controlling department number, and the department manager's last name, address, and birth date Slide 6- 9

10 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 2 For every project located in 'Stafford', list the project number, the controlling department number, and the department manager's last name, address, and birth date Slide 6- 10 PNUMBERDNUMLNAMEADDRESSBDATE 104Wallace291 Berry, Bellaire, TX20-JUN-31 304Wallace291 Berry, Bellaire, TX20-JUN-31

11 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 2 For every project located in 'Stafford', list the project number, the controlling department number, and the department manager's last name, address, and birth date Slide 6- 11 STAFFORD_PROJS   Plocation=’Stafford’ (PROJECT) CONTR_DEPT  (STAFFORD_PROJS Dnum = Dnumber DEPARTMENT) PROJ_DEPT_MGR  (CONTR_DEPT MgrSSN= SSN EMPLOYEE) RESULT   Pnumber, Dnum,Lname, Address,Bdate (PROJ_DEPT_MGR )

12 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 3 Find the names of all employees who work on all the projects controlled by department number 5. Slide 6- 12

13 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 3 Find the names of all employees who work on all the projects controlled by department number 5. Results : empty because no tuples satisfy the criteria Slide 6- 13

14 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 3 Find the names of all employees who work on all the projects controlled by department number 5. Slide 6- 14 DEPT5_PROJS(Pno)   Pnumber(  Dnum=5 (PROJECT) EMP_PROJ   Essn, Pno (WORKS_ON ) RESULT_EMP_SSNS  (EMP_PROJ ÷ DEPT5_PROJS) RESULT   Lname,Fname (RESULT_EMP_SSNS * EMPLOYEE)

15 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 4 List the names of employees who have no dependents. Slide 6- 15

16 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 4 List the names of employees who have no dependents. Slide 6- 16 LNAMEFNAME ZelayaAlicia NarayanRamesh EnglishJoyce JabbarAhmad BorgJames

17 Copyright © 2011 Ramez Elmasri and Shamkant B. Navathe Query 4 List the names of employees who have no dependents. Slide 6- 17 ALL_EMPS   SSN (EMPLOYEE) EMPS_WITH_DEPS ( SSN )   ESSN ( DEPENDENT ) EMPS_WITHOUT_DEPS  (ALL_EMPS - EMPS_WITH_DEPS) RESULT   LNAME, FNAME (EMPS_WITHOUT_DEPS * EMPLOYEE)


Download ppt "Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus تنبيه : شرائح العرض."

Similar presentations


Ads by Google