how to find the particular row in table?(means suppose one
table contain 10 rows , in these 10 rows how to find the
particular row(example in 10 rows i want 5 row how)?

Answers were Sorted based on User's Feedback



how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / guest

select top 1 * from table_name where id in(select top 5 id
from table_name order by desc)

Is This Answer Correct ?    9 Yes 5 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / uma

this is uma sorry the above is wrong.


pls the is the correct answer ,i have this answer

declare cursor on table ,after that open the cusor and
using "fetch" keyword we retrive any row ,and we have
remove the cursor explictly because it is stored in the
memory pls use dellocate keyword


declare cursou_emp2 insensitive scroll cursor for select *
from empdetails [for{readonly}]

open cursou_emp2


fetch absolute 15 from cursou_emp2


deallocate cursou_emp2




it will display 15th row, if u wnt any row u chnage instead
of 15

Is This Answer Correct ?    5 Yes 1 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / murthy

to find a nth row in a table

select top n * from <TableName>
except
select top n-1 * from <TableName>

Is This Answer Correct ?    2 Yes 0 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / vishnu

select top 1 * from (select top 5 * from employee order by
empid)sub order by empid desc

Is This Answer Correct ?    2 Yes 0 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / lince thomas

it is simple,
we can get 5th row using this,


select * from (
select rank() over (order by Empid)as rno,* from empmast)T
where T.rno=5

Is This Answer Correct ?    1 Yes 0 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / murthy

declare @n int
set @n=5
select top (@n) * from employees
except
select top (@n-1) * from employees
GO

Is This Answer Correct ?    1 Yes 0 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / sneha s

fetch the 5th record from a table of 10 records:
select * from emp limit 4,1;

Is This Answer Correct ?    0 Yes 0 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / kishor

select top 1 * from table_name
where id in (select top 5 id from table_name order by id asc)
order by id desc

Is This Answer Correct ?    3 Yes 4 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / uma

all the answers are wrong,the questions is like this there
are 100 rows they want o/p to display is in betwwen 50 and
100 are displayed


select top 100 * from tablename where empid not in(
select top 50 empid from TABLENAME)

Is This Answer Correct ?    1 Yes 2 No

how to find the particular row in table?(means suppose one table contain 10 rows , in these 10 row..

Answer / anup kumar pandey

There are two methods
1> select top 1(name) from anuppandey
or
2>select top 5o percent name from anuppandey

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More SQL Server Interview Questions

Can we make the the chages By Using the Sql if u know any function or process please inform me Actuall result: BRK1 Break 1 Part 1 00:01:00:00 60 BRK1 Break 1 Part 2 00:01:00:00 60 BRK2 Break 2 Part 1 00:01:00:00 60 BRK2 Break 2 Part 2 00:01:00:00 60 BRK2 Break 2 Part 3 00:01:00:00 60 BRK3 Break 3 Part 1 00:01:00:00 60 BRK3 Break 3 Part 2 00:01:00:00 60 Desired O/P: BRK1 Break 1 Part 1 00:01:00:00 60 Part 2 00:01:00:00 60 BRK2 Break 2 Part 1 00:01:00:00 60 Part 2 00:01:00:00 60 Part 3 00:01:00:00 60

0 Answers   Satyam,


What are scalar functions?

0 Answers  


Is mysql the same as sql server?

0 Answers  


How to insert stored procedure result into temporary table?

0 Answers  


event classes in sql server

2 Answers   Accenture, AFE,






What are “lock” hints?

0 Answers  


How many types of cursors are there in SQL Server?

5 Answers   247Customer, CarrizalSoft Technologies,


Write down the syntax and an example for create, rename and delete index?

0 Answers  


Can we have more than one NULL in a column having unique constraint?

12 Answers   247Customer,


A user is a member of the public role and the sales role. The public role has select permission on all the tables. The sales role does not have select permission on some of the tables will the user be able to select from all tables?

0 Answers  


What is mean by candidate key?

0 Answers  


What are the components of dbms?

0 Answers  


Categories