330 likes | 464 Views
LAB 4. FIGURES. EMPLOYEE TABLE. PROJECT TABLE. DEPARTMENT TABLE. DEPENDENT TABLE. WORKS_ON TABLE. DEPT_LOCATIONS TABLE. RENAMING OPERATION. Note : Ssn shouldn’t be underlined. UNION OPERATION. UNION OPERATION. INTERSECTION OPERATION. SET DIFFERENCE (OR MINUS). CARTESIAN PRODUCT.
E N D
LAB 4 FIGURES
RENAMING OPERATION Note : Ssnshouldn’t be underlined.
AGGREGATE FUNCTIONS ᵨ R(Dno,No_of_employees,Average_sal)(Dno COUNT Ssn, AVERAGE Salary(EMPLOYEE)) No renaming :
AGGREGATE FUNCTIONS ᵨ R(Dno,No_of_employees,Average_sal)(Dno COUNT Ssn, AVERAGE Salary(EMPLOYEE)) No grouping :
QUERY 1 Retrievethe name andaddress of allemployeeswhoworkforthe‘Research’ department.
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)))
QUERY 2 • Listthenames of employeeswithtwoormoredependents.
QUERY 2 T1(Ssn, No_of_dependents) <- EssnCOUNT Dependent_name (DEPENDENT) T2 <- σNo_of_dependents>2 (T1) RESULT <- ∏Lname, Fname (T2 * EMPLOYEE)
QUERY 3 • Findthenames of employeeswhowork on alltheprojectscontrolledbydepartmentnumber 5.
QUERY 3 DEPT5_PROJS <- ᵨ(Pno)(∏ Pnumber (σ Dnum=5(PROJECT))) EMP_PROJ <- ᵨ(Ssn,Pno)(∏ Essn,Pno(WORKS_ON))
QUERY 3 RESULT_EMP_SSNS <- EMP_PROJ DEPT5_PROJS RESULT <- ∏ Lname, Fname (RESULT_EMP_SSNS * EMPLOYEE)
QUERY 4 Listthenames of managerswhohave at leastonedependent.
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)