I have student marks in a student table. I need second
highest mark .Then what will the query for this?

Answer Posted / vk

select studentid,student_name,marks from
(select row_number() over (partition by marks order by marks desc) as rnk,studentid,student_name,marks from student_marks)
where studentid in (1,4);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is it unwise to create wide clustered index keys?

663


How many databases can we create in a single server?

193


What is named query? : sql server analysis services, ssas

599


How can you check the version of sql server?

648


What is a dataset and what are the different types of datasets?

97






What is the optimization being performed in oracle and SQL Server?

714


How would you add a section to a table?

669


What is a cache in ssrs?

112


How to scale out a federation by Sql statement?

104


hi, how to link a text file and a .rpt file in my tables of sql server and to retrieve those records for further use. reply me as soon as possible.

1658


How to display a past time in days, hours and minutes?

656


How will you monitor replication latency in transactional replication? : sql server replication

704


What is database dimension? : sql server analysis services, ssas

713


What is the difference between varchar and varchar types?

646


What is the difference between lock, block and deadlock? : sql server database administration

668