Question
Consider the Database in Appendix and write the following SQL queries. 1. Show the first name and the last name of those employees who make
Consider the Database in Appendix and write the following SQL queries.
1. Show the first name and the last name of those employees who make more than the average salary of all employees.
2. Show the first name and the last name of the youngest employee.
3. Show all the locations where departments are located. Do not repeat the information in the output (no duplicates!).
4. Show the name of those employees who are not supervised by any other employee.
5. Show the department number (dno), the number of employees working for those departments and the average salary for each department.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started