Question: Consider the Database in Appendix and write the following SQL queries. Show the entire information about the employees (all rows and columns of the employee
Consider the Database in Appendix and write the following SQL queries.
- Show the entire information about the employees (all rows and columns of the employee table).
- Show the entire information about the employees but sorted in an order such as highest paid employee is in the first row and lowest in the last (James Borg is first and Alica is last).
- Show the entire information about all departments and the name of the manager who manages these departments.
- Show the first name and the last name of those employees who make more than $40,000.
- Show the first name and the last name of those employees who make more than the average salary of all employees.
- Show the first name and the last name of the youngest employee.
- Show all the locations where departments are located. Do not repeat the information in the output (no duplicates!).
- Show the name of those employees who are not supervised by any other employee.
- Show the department number (dno), the number of employees working for those departments and the average salary for each department.
- For those departments which have average salary greater than $50,000, show the department number (dno), the number of employees working for those departments and the average salary for the respective department.
- Show all information about those employees who have dependents.
- Show each employee's first name, last name and his/her manager's first name and last name.
- For those employees who work for department number 5, show employee's first name, last name and his/her salary.
- Show department name for those departments which are located in Stafford.
- Show project numbers (PNO) and total number of hours worked on them.
Appendix

DEPENDANT ESSN 333445555 333445555 333445555 987654321 123456789 123456789 123456789 DEPENDENT NAME Alice Theodore Joy Abner Michael Alice Elizabeth SEX BDATE 4/5/1986 10/25/1983 5/3/1958 M 2/28/1942 1/4/1988 F. 2/12/1988 F 6/5/1967 RELATIONSHIP Daughter Son Spouse Spouse Son Daughter Spouse EMPLOYEE DNO 5 + FNAME MINIT LNAME SSN BDATE ADDRESS John B Smith 123456789 5/9/1965 731 Fondren, Houston, TX Franklin T Wong 333445555 8/12/1955 638 Voss, Houston, TX Alica Zelaya 999887777 7/19/1968 3321 Castle Spring, TX Jennifer S Wallace 987654321 6/20/1941 291 Berry Bellaire, TX Ramesh Narayan 666884444 9/15/1962 975 Fire Oak, Humble, TX Joyce A English 453453453 7/31/1972 5631 Rice, Houston, TX Ahmad Jabbar 987987987 3/29/1969 980 Dallas, Houston, TX James Borg 888665555 11/10/1937 450 Stone, Houston, TX SEX SALARY SUPERSSN M 30000 333445555 M 40000 888665555 F 25000 987654321 F 43000 888665555 M 38000 333445555 F. 25000 333445555 M 25000 987654321 M 55000 + + DEPARTMENT DEPT LOCATION DNAME DNUMBER MGRSSN MGRSTARTDATE Research 333445555 6/22/1988 Admin 987654321 1/1/1995 Headqters 888665555 6/19/1981 DNUMBER + DLOCATION Houston Stafford Bellaire Sugarland Houston 1 ch ch PROJECT WORKS ON PNAME ProductX productY Productz Computerization Reogranization Newbenefits PNUMBER PLOCATION DNUM Bellaire Sugarland Houston Stafford Houston Stafford ESSN PNO HOURS 1234567891 32.5 1234567892 7.5 666884444 3 453453453 453453453 333445555 333445555 333445555 333445555 999887777 30 999887777 10 987987987 987987987 30 987654321 30 987654321 888665555 20 + OOOO WNN- - + 20
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
