1 / 6

List the names of all employees who have a dependent with the same first name as themselves.

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)))

Download Presentation

List the names of all employees who have a dependent with the same first name as themselves.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. 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. 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’;  

More Related