Running into trouble on my final questions for database. Given the following tab
ID: 3694556 • Letter: R
Question
Running into trouble on my final questions for database. Given the following tables:
Employees:
Departments:
Locations:
4. Write a query to get the lowest and average salary of each job that should produce the following result.
5. Write a query to get the difference between the highest and lowest salaries:
6. Write a query to find the name, phone number and salary of the employees who earn a salary that is higher than the salary of all the Shipping Clerk(JOB_ID = 'SH_CLERK').
7. Write a query to find the name, phone number, department name, salary of the employees whose department name is 'shipping' and salary is less than the average salary of all employees:
Explanation / Answer
4) select min(e.salary),avg(e.salary) from employees e inner join departments d on e.job_id=d.job_id
5.) select max(e.salary)-min(e.salary) from employees e inner join departments d on e.job_id=d.job_id
6.) select name,phonenumber,salary from employees where salary >(select salary from employees where job_id='SH_CLERK')
7.) select name,phonenumber,departmentname,salary from employees where job_id=(select job_id from departments where job_id='shipping') and salary<(select avg(salary) from employees)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.