With the schemas given below, please provide SQL code to answer the following qu
ID: 3599158 • Letter: W
Question
With the schemas given below, please provide SQL code to answer the following question.
Q: List the name of the employee and his department name where the employee’s salary is below the average pay of his department that have more than five workers.
EMPLOYEES Name EMP ID FIRST NAME LAST NAME JOB MGR HIRE DATE SALARY COMM PCT DEPT ID Null? Typ NOT NULL NUMBER(4) VARCHAR2(10) VARCHAR2(10) VARCHAR2(9 NUMBER(4) DATE NOT NULL INUMBER NUMBER(7,2 NUMBER(2) DEPARTMENTS Name DEPT ID DEPT NAME DEPT LOC ID Null? Type 11? NUMBER(2) VARCHAR2(20) NUMBERExplanation / Answer
SELECT EMPLOYEES.Name, DEPARTMENTS.Name
FROM EMPLOYEES
INNER JOIN DEPARTMENTS ON EMPLOYEES.DEPT_ID=DEPARTMENTS.DEPT_ID AND EMPLOYEES.COUNT(Name) > 5 AND EMPLOYEES.SALARY < AVG(EMPLOYEES.SALARY);