0% found this document useful (0 votes)
3 views

SQL Practice Questions - 2

The document outlines an SQL assignment that requires writing queries using the HR.EMPLOYEES, HR.DEPARTMENTS, and HR.JOBS tables in Oracle Live SQL. It includes ten specific tasks, such as fetching employee and department details, analyzing job history, and calculating salary metrics. The assignment aims to explore various SQL functionalities and data relationships within the HR database.

Uploaded by

Jahnavi Muvva
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL Practice Questions - 2

The document outlines an SQL assignment that requires writing queries using the HR.EMPLOYEES, HR.DEPARTMENTS, and HR.JOBS tables in Oracle Live SQL. It includes ten specific tasks, such as fetching employee and department details, analyzing job history, and calculating salary metrics. The assignment aims to explore various SQL functionalities and data relationships within the HR database.

Uploaded by

Jahnavi Muvva
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

SQL Assignment 2

Using HR.EMPLOYEES, HR.DEPARTMENTS and HR.JOBS tables in Oracle Live SQL environment, write
SQL queries to answer below questions.
1. Fetch Employee Name, Manager Name and Department Name for all employees.
2. Write an SQL to fetch immediate previous job details of each employee. Required columns
are Employee Id and previous job details (whatever data is available about previous jobs).
3. Write an SQL to fetch below columns.
Department Name, Manager Name, Minimum Salary of Employee under the Manager,
Maximum Salary of Employee under the Manager.
4. Fetch highest salaries against each department. Output Columns: Department Name,
Maximum salary.
5. Order each employee as per their salary among their corresponding department. Output
columns: Department Name, Employee Name, Salary, Position of Employee as per
salary(ex: 1 = Highest salary, 2 = 2nd highest salary so on)
6. Which Manager has the biggest team in the company?
7. Are there any Managers who are reporting to other managers? If so, how many such
managers are there?
8. Write a sql query to fetch below result.

Output columns: Department Name, Join Date, Cost to Company (sum of salaries
company has to pay to all the employees hired until the joining date).
9. Which Employee has the highest commission. (Actual value not the %)
10. Write a SQL query to fetch department wise difference between the employee salary and
his/her next highest salaried employee. Output columns: Department Name, Employee
Name, Salary, Salary Difference.

You might also like