Question: 1. For every employee, write a select statement that return the difference between the salary of the employee and the maximum salary of all employees

1. For every employee, write a select statement that return the difference between the salary of the employee and the maximum salary of all employees that were hired after this employee.
2. Write a select statement (only one statement ) that returns the
a)Sum of employee salaries in every departments
b)Sum of employee salaries every city
c) Sum of employee salaries in every department in a city (for example department in Toronto)
d) Sum of employee salaries in the whole company.
Appendix A - HR Tables 1 dbo.Departments 3 Columns 7 DEPARTMENT_ID (PK, bigint, not null) DEPARTMENT_NAME (varchar(250), null) MANAGER_ID (bigint, null) LOCATION_ID (bigint, null) dbo.Countries Columns 9 Country_ID (PK, varchar(50), not null) Country Name (varchar(250), null) Region_ID (bigint, null) dbo. Employees Columns 9 EMPLOYEE_ID (PK, bigint, not null) D FIRST_NAME (varchar(50), null) LAST_NAME (varchar(50), null) EMAIL (varchar(50), null) PHONE_NUMBER (varchar(50), null) E HIRE_DATE (date, null) JOB_ID (varchar(50), null) E SALARY (int, null) I COMMISSION_PCT (float, null) E MANAGER_ID (bigint, null) DEPARTMENT_ID (bigint, null) dboJobs Columns Job_ID (PK, varchar(50), not null) Job_Title (varchar(50), null) Min_Salary (int, null) Max_Salary(int, null) dbo.Locations Columns 9 Location_id (PK, bigint, not null) Street Address (varchar(50), null) Postal_Code (varchar(50), null) City (varchar(50), null) State_Province (varchar(50), null) Country_ID (varchar(50), null) dbo. Regions Columns Region_ID (PK, bigint, not null) Region_Name (varchar(50), null)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
