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

Where views are stored in sql server?

722


How to generate create view script on an existing view?

739


When does the auto update index statistics feature in sql server turn itself on?q) what specific conditions database should meet, before you can bulk copy data into it using bcp?

756


Can sql server 2016 run on windows 7?

678


What is a view and what are its advantages?

855






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

878


How to generate random numbers with the rand() function in ms sql server?

758


Mention the 3 ways to get a count of the number of records in a table.

716


What is public role in sql server?

746


What is a database in ms sql server?

735


How to delete duplicate rows?

709


What are system databases into sql server (2005/2008)?

759


What are the differences between stored procedure and view in sql server?

838


What are scalar functions in sql?

809


Explain partitioned view?

807