Sunteți pe pagina 1din 6

1.

eados (nombre y apellidos en una sola columna), que ingresaron en el mes de abril y que su nombre empiece con la letra a. nota: buscar al empleado sin restricciones de mayscula y minscula
select FIRST_NAME||' , '||LAST_NAME as "NOMBRE Y APELLIDOS", HIRE_DATE as "FECHA INGRESO" from HR.EMPLOYEES where TO_CHAR(HIRE_DATE, 'MM') = 04 and FIRST_NAME like 'A%'

2. Mustrame la Cantidad de empleados por ciudad.


select LOCATIONS.CITY as "ciudad", count(EMPLOYEES.EMPLOYEE_ID) as "total empleados" from hr.DEPARTMENTS inner join EMPLOYEES on DEPARTMENTS.DEPARTMENT_ID= EMPLOYEES.DEPARTMENT_ID inner join hr.LOCATIONS on LOCATIONS.LOCATION_ID= DEPARTMENTS.LOCATION_ID group by LOCATIONS.CITY

UNIVERSIDAD NACIONAL SAN CRISTOBAL DE HUAMANGA E.F.P DE INGENIERA DE SISTEMAS

3. Mostrar el total de empleados por departamento (nombre del departamento). Ordenarlo por cantidad de empleados en forma descendente
select DEPARTMENTS.DEPARTMENT_NAME as Departamento , count (EMPLOYEES.EMPLOYEE_ID) as "Total empleados" from hr.DEPARTMENTS inner join EMPLOYEES on DEPARTMENTS.DEPARTMENT_ID=EMPLOYEES.DEPARTMENT_ID group by DEPARTMENTS.DEPARTMENT_NAME ORDER BY "Total empleados" DeSC

UNIVERSIDAD NACIONAL SAN CRISTOBAL DE HUAMANGA E.F.P DE INGENIERA DE SISTEMAS

4. Mustrame el promedio mximo de salario de los empleados por ocupacin nombre ocupacion).
select JOBS.JOB_TITLE as Ocupacion, avg (JOBS.MAX_SALARY) AS "promedio salario" from hr.JOBS inner join EMPLOYEES on JOBS.JOB_ID= EMPLOYEES.JOB_ID GROUP BY JOBS.JOB_TITLE ORDER BY "promedio salario" DeSC

5. Mostrar la cantidad de departamentos por pas


select countries.COUNTRY_NAME as "paises", count(departments.DEPARTMENT_ID) as "cantidad departamentos" from hr.COUNTRIES inner join locations on countries.COUNTRY_ID = locations.COUNTRY_ID inner join hr.DEPARTMENTS on locations.LOCATION_ID = departments.LOCATION_ID group by countries.COUNTRY_NAME

UNIVERSIDAD NACIONAL SAN CRISTOBAL DE HUAMANGA E.F.P DE INGENIERA DE SISTEMAS

6. Hacer un reporte, para mostrar los empleados cuyo nombre termina con la A y que pertenezcan pas Mexico.(buscar independientemente si fue ingresado en mayscula o minscula)

select employees.FIRST_NAME as empleado, countries.COUNTRY_ID,countries.COUNTRY_NAME as "Pais" from hr.EMPLOYEES inner join departments on employees.DEPARTMENT_ID = departments.DEPARTMENT_ID inner join hr.LOCATIONS on locations.LOCATION_ID = departments.LOCATION_ID inner join hr.COUNTRIES on countries.COUNTRY_ID =locations.COUNTRY_ID where employees.FIRST_NAME like '%a' or employees.FIRST_NAME like '%A' OR countries.COUNTRY_ID = 'MX'

UNIVERSIDAD NACIONAL SAN CRISTOBAL DE HUAMANGA E.F.P DE INGENIERA DE SISTEMAS

7. Muestra el campo nombre y apellido en una solo columna, departamento (nombre departamento) de aquellos registros de la tabla "empleados" cuyo "department_id" sea 20 50 60

select employees.FIRST_NAME|| ' ' ||employees.LAST_NAME as "Apellido", departments.DEPARTMENT_NAME,departments.DEPARTMENT_ID as "numero depart" from hr.EMPLOYEES inner join departments on employees.DEPARTMENT_ID = departments.DEPARTMENT_ID where departments.DEPARTMENT_ID in (20,50,60)

UNIVERSIDAD NACIONAL SAN CRISTOBAL DE HUAMANGA E.F.P DE INGENIERA DE SISTEMAS

S-ar putea să vă placă și