C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
6
Reply
Find the 5th highest salary of employee.
Sanjay Kesarwani
9y
1.8k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
WITH RESULT AS (SELECT SALARY,DENSE_RANK() OVER (ORDER BY SALARY DESC) AS DENSERANKFROM EMPLOYEES ) SELECT TOP 1 SALARY FROM RESULT WHERE DENSERANK = 5Never use ROW_NUMBER(). Always use DENSE_RANK()
Code Alone
7y
3
SELECT TOP 1 SALARY FROM (SELECT DISTINCT TOP 5 SALARY FROM EMPLOYEES ORDER BY SALARY DESC ) RESULT ORDER BY SALARY
Code Alone
7y
2
WITH Salaries AS (SELECT SalaryAmount, ROW_NUMBER() OVER(ORDER BY SalaryAmount DESC) AS 'RowNum'FROM dbo.SalaryTable ) SELECTSalaryAmount FROMSalaries WHERERowNum = 5
Rakesh Jogani
8y
2
1) C# doesn't support Multiple inheritance ( means deriving a class from more than one class)... If your application supposed to have more than one class features at a time, For ex : we can inherit one class and other interface as follows: Public class ChildClass : BaseClass, BaseInterface{ ................ }) An abstract class can have shared state or functionality. An interface is only a promise to provide the state or functionality. A good abstract class will reduce the amount of code that has to be rewritten because it's functionality or state can be shared. The interface has no defined information to be shared
Shashikant Patil
8y
0
1) C# doesn't support Multiple inheritance ( means deriving a class from more than one class)... If your application supposed to have more than one class features at a time, For ex : we can inherit one class and other interface as follows: Public class ChildClass : BaseClass, BaseInterface{ ................ }) An abstract class can have shared state or functionality. An interface is only a promise to provide the state or functionality. A good abstract class will reduce the amount of code that has to be rewritten because it's functionality or state can be shared. The interface has no defined information to be shared
Shashikant Patil
8y
0
Select Min(Salary) from ( Select top 5 Salary from table order by desc) T1
Sanjay Kesarwani
9y
0
Message