Practicas LECCION 6 Oracle
Practicas LECCION 6 Oracle
Practicas LECCION 6 Oracle
1. Write a query for the HR department to produce the addresses of all the
departments. Use the LOCATIONS and COUNTRIES tables. Show the location
ID, street address, city, state or province, and country in the output. Use a
NATURAL JOIN to produce the results.
SELECT location_id, street_address, city, state_province, country_name
FROM locations
NATURAL JOIN countries;
6. Create a report for the HR department that displays employee last names,
department numbers, and all the employees who work in the same department
as a given employee. Give each column an appropriate label. Save the script to
a file named lab_06_06.sql.
DESC JOB_GRADES
SELECT e.last_name, e.job_id, d.department_name, e.salary, j.grade_level
FROM employees e JOIN departments d ON (e.department_id = d.department
_id) JOIN job_grades j ON (e.salary BETWEEN j.lowest_sal AND j.highest_sal);
9.The HR department needs to find the names and hire dates of all the employees
who were hired before their managers, along with their managers’ names and
hire dates. Save the script to a file named lab_06_09.sql.