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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / lokeshwaran s

SELECT MAX(marks) AS second_highest_mark
FROM student
WHERE marks < (SELECT MAX(marks) FROM student);

Is This Answer Correct ?    0 Yes 0 No

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

Answer / koti,khammam

select max(mark) from student where mark not in (select max
(mark) from student)

Is This Answer Correct ?    1 Yes 2 No

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

Answer / poomanibe

with temptab as
(
select row_number() over(order by substring(marks,1,2)) as
rownum,* from Student
)
select * from temptab where rownum=1

Is This Answer Correct ?    0 Yes 1 No

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

Answer / dharmendra k. dixit

SELECT TOP 1 Marks (SELECT TOP 2 Marks from Tablename Order
by Marks Desc)From Tablename order by Marks Asc

Is This Answer Correct ?    0 Yes 2 No

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

Answer / rupa

Select max(Marks) from Marks where Marks <
(select max(Marks)from Marks)

Is This Answer Correct ?    0 Yes 2 No

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

Answer / sagesh

SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY mark) AS Stu_Rank
FROM student) As T
WHERE Stu_Rank = 2

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More SQL Server Interview Questions

what are user defined datatypes? : Sql server database administration

0 Answers  


How use inner join in sql server?

0 Answers  


What is sql server programming?

0 Answers  


What is Online Index Rebuild Operation?

1 Answers  


Do you know what are the differences between lost updates and uncommitted dependencies?

0 Answers  






What type of locking occurs during the snapshot generation? : sql server replication

0 Answers  


What is a stored procedure?

3 Answers  


Which system tables contain information on privileges granted and privileges obtained

1 Answers  


In clustered and non clustered indexes which one is faster while executing a query ?

1 Answers  


Once setting replication, is it potential to own a publisher as sixty four bit sql server and distributor or subscribers as a thirty two bit sql server?

0 Answers  


How to create indexed view?

0 Answers  


What is view in sql?

0 Answers  


Categories