I have student marks in a student table. I need second
highest mark .Then what will the query for this?
Answer Posted / sanjay
create table test(id int identity,marks int)
insert into test
select 20
union all
select 31
union all
select 33
union all
select 1
union all
select 3
union all
select 100
union all
select 88
select * from test
with data as
(
select marks,row_number() over(order by marks desc) as rno
from test
)
select * from data where rno = 3
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
How to transfer a table from one schema to another?
what are the steps you will take to improve performance of a poor performing query? : Sql server database administration
What is dynamic cursor in SQL SERVER?
How the authentication mode can be changed?
What are commit and rollback in sql?
How to rebuild the master database?
Which sql server table is used to hold the stored procedure script?
How to use values from other tables in update statements in ms sql server?
Explain about Normalization?
Which joins are sql server default?
How to rebuild all indexes on a single table?
Do you know how to make remote connection in database?
How can we improve performance by using SQL Server profiler?
Explain comment on transactions?
What are built in functions?