Assignment for Sub Queries
See the below tables and solve the given queries.
Table: Employee
Employee_id |
First_Name |
Last_Name |
Salary |
Joining_date |
Department |
1 |
John |
Abraham |
1000000 |
01JAN13 12.00.00 AM |
Banking |
2 |
Michael |
Clarke |
800000 |
01JAN13 12.00.00 AM |
Insurance |
3 |
Roy |
Thomas |
700000 |
01FEB1312.00.00 AM |
Banking |
4 |
Tom |
Jose |
600000 |
01FEB1312.00.00 AM |
Insurance |
5 |
Jerry |
Pinto |
650000 |
01FEB1312.00.00 AM |
Insurance |
6 |
Philip |
Mathew |
750000 |
01JAN1312.00.00 AM |
Services |
7 |
TestName1 |
123 |
650000 |
01JAN1312.00.00 AM |
Services |
8 |
TestName2 |
Lname% |
600000 |
01FEB1312.00.00 AM |
Insurance |
Table: Incentives
Employee_ref_id |
Incentive_date |
Incentive_amount |
1 |
01-FEB-13 |
5000 |
2 |
01-FEB-13 |
3000 |
3 |
01-FEB-13 |
4000 |
1 |
01-JAN-13 |
4500 |
2 |
01-JAN-13 |
3500 |
Questions
- Select employee details from employee table if data exists in incentive table.
- Get Employee ID's of those employees who didn't receive incentives.
- Select 20 % of salary from John, 10% of Salary for Roy and for other 15 % of salary from employee table.
- Select Banking as 'Bank Dept', Insurance as 'Insurance Dept' and Services as 'Services Dept' from employee table.
- Select max incentive with respect to employee from employee and incentives table using sub query.
- Select 2nd Highest salary from employee table using sub query.
- Show different dept as columns and number of employee in that dept as rows.
- Show different salary as columns and number of employee with that salary as rows.
Note:
- Upload screenshots containing query and its output in either jpg or png format.
- Name of screenshot file name must be Question No. i.e. 1.jpg or 1.png.
- Optional questions are not required to submit.