Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What stored by the msdb? : sql server database administration

1001


what is an extended stored procedure? : Sql server database administration

1052


what are the steps you will take to improve performance of a poor performing query? : Sql server database administration

940


What is the difference between varchar and varchar(max) datatypes?

1069


How to loop through result set objects using odbc_fetch_row()?

975


Describe in brief authentication modes in sql server.

1025


How do I setup a sql server database?

1071


Sql server reporting services vs. Crystal reports.

131


What are the advantages dts has over bcp?

1000


What do you mean by normalisation?

1035


why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it? : Sql server administration

1051


Explain different types of collation sensitivity?

977


How can you insert values in multiple rows using one Insert statement?

1091


What is difference between views and stored procedures?

987


Explain transaction server explicit transaction?

928