0% found this document useful (0 votes)
26 views2 pages

LeadSquared - Assignment - MySQL - DBA - II - v1.0

The document provides sample employee and incentive data across two tables and asks questions to write SQL queries against the data. It asks for queries such as the number of employees per department, top level manager per department, second highest incentive in February 2013, minimum incentive in 2013, employees who did not get incentives in January 2013, and month with highest incentives. It also asks which indexes would be recommended on the tables.

Uploaded by

Rupal Pursharthi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

LeadSquared - Assignment - MySQL - DBA - II - v1.0

The document provides sample employee and incentive data across two tables and asks questions to write SQL queries against the data. It asks for queries such as the number of employees per department, top level manager per department, second highest incentive in February 2013, minimum incentive in 2013, employees who did not get incentives in January 2013, and month with highest incentives. It also asks which indexes would be recommended on the tables.

Uploaded by

Rupal Pursharthi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MySQL DBA – II

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

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE MANAGER DEPARTMENT

1 John Abraham 1000000 01-JAN-13 12.00.00 AM 3 Banking

2 Michael Clarke 800000 01-JAN-13 12.00.00 AM 4 Insurance

3 Roy Thomas 700000 01-FEB-13 12.00.00 AM Banking

4 Tom Jose 600000 01-FEB-13 12.00.00 AM Insurance

5 Jerry Pinto 650000 01-FEB-13 12.00.00 AM 4 Insurance

6 Philip Mathew 750000 01-JAN-13 12.00.00 AM 7 Services

7 TestName1 123 650000 01-JAN-13 12.00.00 AM Services

LeadSquared Confidential Date of Issue: 04-Feb-2020 Page 1 of 2


MySQL DBA – II
Table: Incentives
EMPLOYEE_REF_ID INCENTIVE_DATE INCENTIVE_AMOUNT
1 06-FEB-13 5000

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.

LeadSquared Confidential Date of Issue: 04-Feb-2020 Page 2 of 2

You might also like