consultas oracle sql.docx
TRANSCRIPT
* Empleados que ganan más que el promedio de salario de su departamento.
* Empleados contratados en el año 1994.
* Mostrar el número de empleados, el apellido, el salario, el salario aumentado en un 15,5% sólo para los empleados que ganan menos de 10000 y una columna con el monto aumentado(Incremento).
Seleccionar first_name, last_name, department_name.select first_name, last_name, department_name from hr.employees e join hr.departments d on e.department_id = d.department_id
Seleccionar la cantidad de empleados por departamento.select count(employee_id),department_name from hr.employees e join hr.departments d on e.department_id = d.department_id group by (d.department_name)
Cantidad de empleados por ciudad.select count(employee_id),city from (hr.employees e join hr.departments d on e.department_id = d.department_id) join hr.locations l on d.location_id = l.location_id group by (l.city)
Cantidad de departamentos por país.select count(department_id),country_name from (hr.departments d join hr.locations l on d.location_id = l.location_id) join hr.countries c on l.country_id = c.country_id group by (c.country_name)
Muestra la cantidad de empleados por región
select count(employee_id),region_name from(((hr.employees e join hr.departments d on e.department_id = d.department_id)join hr.locations l on d.location_id = l.location_id)joinhr.countries c on l.country_id = c.country_id) joinhr.regions r on c.region_id = r.region_id group by (r.region_name) Muestra la cantidad de empleados por país select count(employee_id),country_name from(((hr.employees e join hr.departments d on e.department_id = d.department_id)join hr.locations l on d.location_id = l.location_id)joinhr.countries c on l.country_id = c.country_id) joinhr.regions r on c.region_id = r.region_id group by (c.country_name)
Cantidad de empleados por país y por regiónselect region_name,country_name,count(employee_id)from(((hr.employees e join hr.departments d on e.department_id = d.department_id)joinhr.locations l on d.location_id = l.location_id)joinhr.countries c on l.country_id = c.country_id) joinhr.regions r on c.region_id = r.region_id group by (c.country_name,r.region_name)