Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to write the following 4 queries in an ORACLE SQL databse. Tables: Employees

ID: 3908531 • Letter: H

Question

How to write the following 4 queries in an ORACLE SQL databse.

Tables: Employees, Departments

Find the lowest salary earned by any employee in each department. Display only those departments where the minimum basic salary is less than $8,000. Display both the department ID and highest salary. Find the total number of employees working in each department. Display only those departments that have a count greater than 3. 7. 8. 9. Display the HOD and number of employees working for each HOD. 10. Display the department name and average salary of all the employees in each department. Sort the output by average salary.

Explanation / Answer

10. SELECT DEPT_NAME, AVG(SAL) FROM EMPLOYEES GROUP BY DEPT_NAME ORDER BY AVG(SAL).

9. SELECT HOD, COUNT(EMP_ID) FROM EMPLOYEES WHERE EMP_ID.DEPT = HOD.DEPT;

8. SELECT COUNT(*) FROM EMPLOYEE GROUP BY DEPT HAVING COUNT(*) > 3;

Answer may change as per table structure

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote