LeadSquared - Assignment - MySQL - DBA - II - v1.0
LeadSquared - Assignment - MySQL - DBA - II - v1.0
Instructions
Please read the following assignment carefully & the questions have been asked at the end of the task. You should finish the
following assignment in 60 minutes. Consider the following employee data in relational tables and write queries for questions
below the data. Please don’t take the data as it is mentioned in the table – it is a sample dataset. There can be more data in the
table, please write your answers accordingly. Please don’t use CTE, Rank, Top, Rownum and LIMIT clauses. Speak to the
recruitment coordinator in case you have any doubts
Table: Employee
2 01-FEB-13 3000
3 07-FEB-13 4000
1 01-JAN-13 4500
2 04-JAN-13 3500
1 08-FEB-13 6000
SQL Queries
1. Write a query to print the number of employees per department in the organization.
2. Write an SQL query to find the name of the top-level manager of each department.
3. Write a query to find the employee who got second maximum incentive in February 2013.
4. Write a query to find the employee who got the minimum incentive in 2013.
5. Write a query to find employees who did not get any incentive in January 2013.
6. Write a query to find the month where employees got maximum incentive.
7. Given the above queries, which indexes would you recommend on both the tables.