RDBMS HandsOn
RDBMS HandsOn
iNext Ltd, a product based company with more than 50000 employees, that provides product
solutions to large number of clients from different countries. It uses a software product to
maintain their employee’s information and their project allocation details. The application is used
by the following user groups:
Employees
Consultants
Project Manager
Employee:
Project:
Write SQL queries for the scenarios listed below. (Maximum Marks: 40)
1. Display the employee id, employee name and salary for all Consultants who are drawing
a salary in the range of 50000 to 100000. (3 marks)
2. Display the employee id, employee name, project id of all Permanent employees who
are allocated to ‘JavaEE’ technology. (3 marks)
3. Get the names of all employees who are project managers along with their project id. (5
marks)
4. For each project, display the project id, project name and number of employees who are
allocated to it. Display ‘NA’ if no employees are allocated to a project. (5 marks)
5. List the employee id, employee name of all employees who are managing two or more
projects. (3 marks)
6. Retrieve the employee name, employee id of all employees who are working for the
same project as the employee with name – ‘John’. Do not display the record of John in
the result. (5 marks)
7. Retrieve the employee id, employee name, employee type and salary of those
employees who are drawing the maximum salary in each employee type. (5 marks)
8. Identify the employees who are working for the same project. Display the employee id
and employee name of those employees without any duplicate rows. (5 marks)
9. Find the average salary of different types of employees - Permanent employees and
Consultants. Display the type and average salary if the identified average salary is more
than 50000. (3 marks)
10. Display the employee type, project id and average salary of employees belonging to
projects with project id ‘P1001’ or ‘P1002’. (3 marks)