I have student marks in a student table. I need second
highest mark .Then what will the query for this?
Answer Posted / dinesh gupta
4th highest salary
SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY
grosssalary desc) AS salaryno , *
FROM (
select distinct grosssalary
from salarydetails where inmon='dec' and inyear = 2007
) as a
) As T
WHERE t.salaryno = 4
3rd lowest salary
SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY
grosssalary ) AS salaryno , *
FROM (
select distinct grosssalary
from salarydetails where inmon='dec' and inyear = 2007
) as a
) As T
WHERE t.salaryno = 3
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Can coalesce return null?
If a stored procedure is taking a table data type, how it looks?
Is sql server a database?
What are the benefits of normalization?
What does executeupdate return?
How to access the deleted record of an event?
What is the cartesian product of table?
Explain about builtinadministrator?
I have all the primary data files, secondary data files as well as logs. Now, tell me can I still restore the database without having a full backup? : sql server database administration
Can a table be created inside a trigger?
How can you find out how many rows returned in a cursor?
What are the advantages of user-defined functions over stored procedures in sql server?
Can a database be shrunk to 0 bytes, if not, why?
How to enforce security in sql server? : sql server security
How are the unique and primary key constraints different?