C) Which employees earn less salary than the average salary for the consultants who perform the same job? Show the employees first and last names, job id, salary, department name, and manager's last name. Sort the result by the employees’ employee id. D) For each department, find the manager who pays out the most in salaries. Show the department number, the manager's last name, and the total she/he pays each month. Sort by the department number. Here are the tables and the columns within the table Here are the tables and the columns within the table CONSULTANTS - CONSULTANT_ID - FIRST_NAME - LAST_NAME - EMAIL - PHONE_NUMBER - HIRE_DATE - JOB_ID - SALARY - COMMISSION_PCT - MANAGER_ID - DEPARTMENT_ID . COUNTRIES - COUNTRY_ID - COUNTRY_NAME -REGION_ID . CUSTOMERS - CUST_ID CUST_EMAIL CUST_FNAME CUST_LNAME CUST_ADDRESS CUST_CITY CUST_STATE_PROVINCE CUST_POSTAL_CODE CUST_COUNTRY CUST_PHONE CUST_CREDIT_LIMIT . DEPARTMENTS - DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID . EMPLOYEES - EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID . JOB_HISTORY - EMPLOYEE_ID START_DATE END_DATE JOB_ID DEPARTMENT_ID . JOBS - JOB_ID JOB_TITLE MIN_SALARY MAX_SALARY . LOCATIONS - LOCATION_ID STREET_ADDRESS POSTAL_CODE CITY STATE_PROVINCE COUNTRY_ID . REGIONS - REGION_ID REGION_NAME . SAL_GRADES - GRADE_LEVEL LOWEST_SAL HIGHEST_SAL . SALES - SALES_ID SALES_TIMESTAMP SALES_AMT SALES_CUST_ID SALES_REP_ID
C) Which employees earn less salary than the average salary for the consultants who perform the same job? Show the employees first and last names, job id, salary, department name, and manager's last name. Sort the result by the employees’ employee id.
D) For each department, find the manager who pays out the most in salaries. Show the department number, the manager's last name, and the total she/he pays each month. Sort by the department number. Here are the tables and the columns within the table
Here are the tables and the columns within the table
CONSULTANTS
- CONSULTANT_ID
- FIRST_NAME
- LAST_NAME
- EMAIL
- PHONE_NUMBER
- HIRE_DATE
- JOB_ID
- SALARY
- COMMISSION_PCT
- MANAGER_ID
- DEPARTMENT_ID
.
COUNTRIES
- COUNTRY_ID
- COUNTRY_NAME
-REGION_ID
.
CUSTOMERS
- CUST_ID
CUST_EMAIL
CUST_FNAME
CUST_LNAME
CUST_ADDRESS
CUST_CITY
CUST_STATE_PROVINCE
CUST_POSTAL_CODE
CUST_COUNTRY
CUST_PHONE
CUST_CREDIT_LIMIT
.
DEPARTMENTS
- DEPARTMENT_ID
DEPARTMENT_NAME
MANAGER_ID
LOCATION_ID
.
EMPLOYEES
- EMPLOYEE_ID
FIRST_NAME
LAST_NAME
EMAIL
PHONE_NUMBER
HIRE_DATE
JOB_ID
SALARY
COMMISSION_PCT
MANAGER_ID
DEPARTMENT_ID
.
JOB_HISTORY
- EMPLOYEE_ID
START_DATE
END_DATE
JOB_ID
DEPARTMENT_ID
.
JOBS
- JOB_ID
JOB_TITLE
MIN_SALARY
MAX_SALARY
.
LOCATIONS
- LOCATION_ID
STREET_ADDRESS
POSTAL_CODE
CITY
STATE_PROVINCE
COUNTRY_ID
.
REGIONS
- REGION_ID
REGION_NAME
.
SAL_GRADES
- GRADE_LEVEL
LOWEST_SAL
HIGHEST_SAL
.
SALES
- SALES_ID
SALES_TIMESTAMP
SALES_AMT
SALES_CUST_ID
SALES_REP_ID
Trending now
This is a popular solution!
Step by step
Solved in 2 steps