Assignment for Window Function, Pivot & Unpivot

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

 

  1. Show different dept as columns and number of employee in that dept as rows.
  2. Show different salary as columns and number of employee with that salary as rows.
  3. Write An SQL Query To Show Only Even Rows From employee table (Define Your Own Order).
  4. Write An SQL Query To Determine The Nth (Say N=5) Highest Salary From employee Table (Define Your Own Order).
  5. Write An SQL Query To Fetch The First 50% Records From A Table (Define Your Own Order).

Note:

  1. Upload screenshots containing query and its output in either jpg or png format.
  2. Name of screenshot file name must be Question No. i.e. 1.jpg or 1.png.
  3. Optional questions are not required to submit.