The document contains multiple SQL queries that analyze employee data by department and role. The queries calculate minimum, maximum, and average salaries by department. They also count the number of employees by job role and department, identifying the role and department with the maximum and minimum counts. Finally, queries calculate total salary, maximum salary, minimum salary, and average salary by department.
The document contains multiple SQL queries that analyze employee data by department and role. The queries calculate minimum, maximum, and average salaries by department. They also count the number of employees by job role and department, identifying the role and department with the maximum and minimum counts. Finally, queries calculate total salary, maximum salary, minimum salary, and average salary by department.
The document contains multiple SQL queries that analyze employee data by department and role. The queries calculate minimum, maximum, and average salaries by department. They also count the number of employees by job role and department, identifying the role and department with the maximum and minimum counts. Finally, queries calculate total salary, maximum salary, minimum salary, and average salary by department.
SELECT d.dpto, MIN(e.sueldo) AS sueldo_minimo, MAX(e.
sueldo) AS sueldo_maximo FROM dpto AS d JOIN empleado AS e ON d.iddpto = e.iddpto GROUP BY d.dpto
SELECT d.dpto, AVG(e.sueldo) AS sueldo_promedio
FROM dpto AS d JOIN empleado AS e ON d.iddpto = e.iddpto GROUP BY d.dpto
SELECT CARGO, COUNT(*) AS EMPLEADOS
INTO #tmp FROM CARGO AS C, EMPLEADO AS E WHERE C.IDCARGO = E.IDCARGO GROUP BY CARGO GO SELECT * FROM #tmp WHERE EMPLEADOS = (SELECT MAX (EMPLEADOS) FROM #tmp ) DROP TABLE #tmp
SELECT DPTO, COUNT(*) AS EMPLEADOS
INTO #tmp FROM DPTO AS D, EMPLEADO AS E WHERE D.IDDPTO = E.IDDPTO GROUP BY DPTO GO SELECT * FROM #tmp WHERE EMPLEADOS = (SELECT MIN (EMPLEADOS) FROM #tmp ) DROP TABLE #tmp
SELECT DPTO, SUM ( SUELDO) AS Total_Sueldo
FROM DPTO AS D, EMPLEADO AS E WHERE D.IDDPTO = E.IDDPTO GROUP BY DPTO
SELECT DPTO, MAX(SUELDO) AS Mayor,
MIN(SUELDO) AS Menor, AVG (SUELDO) AS Promedio FROM DPTO AS D, EMPLEADO AS E WHERE D.IDDPTO = E.IDDPTO GROUP BY DPTO