Find top Nth employee from each department in terms of
salary?
Answer Posted / madhu sudhan g
Hi,
For suppose the table is like emp having some departments
Here i am retrieving some 'X' department employees
;WITH myTableWithRows AS (
SELECT (ROW_NUMBER() OVER (ORDER BY Salary)) as row,*
FROM emp)
SELECT empname
FROM myTableWithRows
WHERE row = Nth row and
Dept='x'
ORDER BY Salary
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Write a code to select distinct records without using the DISTINCT keyword.
What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?
What is sparse columns of sql server 2008?
What happens if the update subquery returns multiple rows in ms sql server?
What is reference section?
What do you mean by stored techniques? How would we use it?
Write a program using SQL queries to find a unique entry in a table.
Explain database normalization?
What is mean by clustered index and non clustered index, give syntax of creation? : sql server database administration
query processing
What information is maintained within the msdb database?
What are the steps you must follow to hide sql server instances?
how can you check the level of fragmentation on a table? : Sql server administration
How to test values returned by a subquery with the in operator?
How to truncate the log in sql server 2012? : sql server database administration