Presentation is loading. Please wait.

Presentation is loading. Please wait.

LAB 4 FIGURES.

Similar presentations


Presentation on theme: "LAB 4 FIGURES."— Presentation transcript:

1 LAB 4 FIGURES

2 EMPLOYEE TABLE

3 PROJECT TABLE

4 DEPARTMENT TABLE

5 DEPENDENT TABLE

6 WORKS_ON TABLE

7 DEPT_LOCATIONS TABLE

8 RENAMING OPERATION Note : Ssn shouldn’t be underlined.

9 UNION OPERATION

10 UNION OPERATION

11 INTERSECTION OPERATION

12 SET DIFFERENCE (OR MINUS)

13 CARTESIAN PRODUCT

14 CARTESIAN PRODUCT

15 CARTESIAN PRODUCT

16 JOIN OPERATION

17 NATURAL JOIN OPERATION

18 NATURAL JOIN

19 LEFT OUTER JOIN

20 LEFT OUTER JOIN

21 RIGHT OUTER JOIN

22 DIVISION OPERATION

23 AGGREGATE FUNCTIONS ᵨ R(Dno,No_of_employees,Average_sal)(Dno COUNT Ssn, AVERAGE Salary(EMPLOYEE)) No renaming :

24 AGGREGATE FUNCTIONS ᵨ R(Dno,No_of_employees,Average_sal)(Dno COUNT Ssn, AVERAGE Salary(EMPLOYEE)) No grouping :

25 QUERY 1 Retrieve the name and address of all employees who work for the ‘Research’ department.

26 QUERY 1 RESEARCH_DEPT <- σ Dname=’Research’ (DEPARTMENT)
RESEARCH_EMPS <- (RESEARCH_DEPT Dnumber=Dno EMPLOYEE) RESULT <- ∏ Fname, Lname, Address (RESEARCH_EMPS) OR ∏ Fname, Lname, Address (σ Dname=’Research’(DEPARTMENT Dnumber=Dno (EMPLOYEE)))

27 QUERY 2 List the names of employees with two or more dependents.

28 QUERY 2 T1(Ssn, No_of_dependents) <- Essn COUNT Dependent_name (DEPENDENT) T2 <- σ No_of_dependents>2 (T1) RESULT <- ∏ Lname, Fname (T2 * EMPLOYEE)

29 QUERY 3 Find the names of employees who work on all the projects controlled by department number 5.

30 QUERY 3 DEPT5_PROJS <- ᵨ(Pno)(∏ Pnumber (σ Dnum=5(PROJECT)))
EMP_PROJ <- ᵨ(Ssn,Pno)(∏ Essn,Pno(WORKS_ON))

31 QUERY 3 RESULT_EMP_SSNS <- EMP_PROJ  DEPT5_PROJS
RESULT <- ∏ Lname, Fname (RESULT_EMP_SSNS * EMPLOYEE)

32 QUERY 4 List the names of managers who have at least one dependent.

33 QUERY 4 MGRS(Ssn) <- ∏ Mgr_ssn (DEPARTMENT)
EMPS_WITH_DEPS(Ssn) ∏ Essn (DEPENDENT) MGRS_WITH_DEPS <- (MGRS ∩ EMPS_WITH_DEPS) RESULT <- ∏ Lname, Fname (MGRS_WITH_DEPS * EMPLOYEE)


Download ppt "LAB 4 FIGURES."

Similar presentations


Ads by Google