Presentation is loading. Please wait.

Presentation is loading. Please wait.

Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on.

Similar presentations


Presentation on theme: "Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on."— Presentation transcript:

1 Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on |X| pno = pnumber(Π pnumber (σ pname = ‘ProductX’ (project)))) Π lname, minit, fname (σ dno = 5 (employee |X| ssn = essn (p10ssn))) select lname, minit, fname from employee, works-on, project where ssn = essn AND pno = pnumber AND dno = 5 AND hours > 10 AND pname = ‘Product X’;

2 select lname, minit, fname from employee, dependent
List the names of all employees who have a dependent with the same first name as themselves. Π lname, minit, fname (employee |X| fname = dependent-name AND ssn = essn (dependent)) select lname, minit, fname from employee, dependent where fname = dependent-name AND ssn = essn;

3 Find the names of all employees who are directly supervised by ‘Franklin Wong’.
Π lname, minit, fname (employee |X| superssn = ssn (Π ssn (σ fname = ‘Franklin’ AND lname = ‘Wong’ (employee)))) select employee.lname, employee.minit, employee.fname from employee emp where emp.lname = ‘Wong’ AND emp.fname = ‘Franklin’ AND employee.superssn = emp.ssn;  

4 For each project, list the project name and the total hours per week (by all employees) spent on that project. pname F sum hours (project |X| pnumber = pno (works-on)) select pname, sum(hours) from project, works-on where pno = pnumber group by pname;  

5 select dname, average(salary) from department, employee
For each department, retrieve the department name and the average salary of all employees working in that department. dname F average salary (department |X| dnumber = dno (Π dno, salary, ssn (employee))) select dname, average(salary) from department, employee where dnumber = dno group by dname;

6 Retrieve the average salary of all female employees.
F average salary (σ sex = ‘F’ (employee)) select average (salary) from employee where sex = ‘f’;  


Download ppt "Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on."

Similar presentations


Ads by Google