Question: I need help with a few SQL database codes to return some resutls! The queries that I need to write are described below this and

I need help with a few SQL database codes to return some resutls! The queries that I need to write are described below this and the tables I have are described below the questions.

--------------------

*Find pairs of employee lname's such that the two employees in the pair work on the same project for the same number of hours. List every pair once only. Sort the result by the lname in the left column in the result.

*For every employee who has more than one dependent: Find the ssn, lname, and number of dependents. Sort the result by lname

*For every project that has more than 2 employees working on and the total hours worked on it is less than 40: Find the project number, project name, number of employees working on it, and the total number of hours worked by all employees on that project. Sort the results by project number.

*For every employee whose salary is above the average salary in his department: Find the dno, ssn, lname, and salary. Sort the results by department number.

*For every employee who works for the research department but does not work on any one project for more than 20 hours: Find the ssn and lname. Sort the results by lname

*For every employee who works on every project that is controlled by department 4: Find the ssn and lname. Sort the results by lname

-----------------

Tables

-

employee, department, dept_locations, project, works_on, dependent

-

Keys in order of tables

-

fname, lname, ssn, bdate, address, sex, super_ssn, dno

dnumber, dname, mgrssn, mgrstartdate

dnumber, dlocation

pname, pnumber, plocation, dnum

essn, pno, hours

essn, dependent_name, sex, bdate, relationship

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!