Wednesday, 8 March 2017

Finding Highest and lowest Value in Table(Highest Nth Value and Lowest Value )

Finding nth Highest Value in Table 

In many interviews you may get these kind of questions so here is different way to solve this 

I. Enter to Database 

 Use Employee ;

II. Display all the details of Employee table 

  Select * from tblEmployee;



III. To Find Nth Highest Salary in tblEmployee

 

Resultant set:

IV. To Find 2nd Highest Salary in tblEmployee




Resultant set:

V. To Find Lowest Salary in tblEmployee



Resultant set:

VI. To Find 2nd Lowest Salary in tblEmployee


Resultant set:

Using Corelated Sub Query

VII. To Find Nth Highest Salary in tblEmployee



Resultant set:

VIII. To Find 2nd Highest Salary in tblEmployee


Resultant set:

IX. To Find Lowest Salary in tblEmployee


Resultant set:


X. To Find 2nd Lowest Salary in tblEmployee



Resultant set:


Hope you all understand how to find the Highest and lowest value in given table  ..  


Do have any query regarding my code you can comment below !!! 

No comments:

Post a Comment