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
What is a coalesce function?
Explain encryption of entire databases without the need for application changes in sql server 2008?
What is acid mean in sql server?
What is meant by indexing files?
Explain different types of collation sensitivity?
What are the default system databases in sql server 2000?
Why do we use non clustered index?
What is a primary index?
Why we should not use triggers?
What is sql injection? How to protect against sql injection attack?
How to select some specific columns from a table in a query in ms sql server?
Can you name some of the dml commands in sql?
Describe how to use the linked server?
What do mean by xml datatype?
What is page in sql server?