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

i use few third party softwares. they r all having their own databases . but the data is repeated in all these databases - say a person is in all the three databases, but his name is stoared in diff format in all databases i want to create a centralised database ,and i dont want to re-enter the records . using the exisating records how can i build a centralised database?

1 Answers   Fidelity,


What does select 1 mean?

0 Answers  


What do you mean by COLLATION?

4 Answers   ABC, BirlaSoft,


what are the different types of replication you can set up in sql server? : Sql server database administration

0 Answers  


What is explicit mode in sql server?

0 Answers  






What is the difference between getdate and sysdatetime?

0 Answers  


Explain DBMS, RDBMS?

6 Answers  


Any one plz send me SQL Server Developer/DBA resume for 4 years experience

0 Answers  


I need a query that retrieves info from an Oracle table and a query that retrieves info from a SQL Server table. The info has to be joined together according to Record ID numbers. I have very limited access to the Oracle database but full control of the SQL Server database.How do I join two different queries from two different databases?

1 Answers  


What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.

0 Answers  


What is left outer join in sql server joins?

0 Answers  


Where can you add custom error messages to sql server?

0 Answers  


Categories