List the department, the total salary of the departments that the sum of their salary is greater than 20000.
SELECT D.DEPARTMENT_NAME,SUM(E.SALARY) FROM DEPARTMENTS DINNER JOIN EMPLOYEES E ON D.DEPARTMENT_ID=E.DEPARTMENT_ID GROUP BY D.DEPARTMENT_NAME;
The problem with the first query is how can I put the total salary of each department in the WHERE so that it is greater than 20000
Create a select that presents the id of the position, the description of the position, the number of employees for departments that have 4 employees.
SELECT J.JOB_ID,J.JOB_TITLE FROM JOBS J INNER JOIN EMPLOYEES E ON J.JOB_ID=E.JOB_ID;
The problem with the second query is how do I get the number of employees for the departments that have more than 4 employees
Display a select where I displayed the positions where the average salary is greater than 10000.
SELECT E.JOB_ID,AVG(E.SALARY) FROM EMPLOYEES E GROUP BY JOB_ID;
The problem with the third query is like the problem of the first query as I put the average of the wages in the WHERE and that this is greater than 10,000
In query 1 and 3 when I try to do MAX
and AVG
in WHERE
I get an error and try to do it in SELECT
but% WHERE
does not read ALIAS