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 / senthilkumar

SELECT TOP 1 Empid
FROM (SELECT DISTINCT TOP 6 Empid FROM Employees ORDER
BY Empid desc) a ORDER BY Empid asc

Is This Answer Correct ?    4 Yes 6 No

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

Answer / vamsi krishna

select * from <table name> order by <column name> limit 0,5;
or
select * from <table name> limit 0,5;

Is This Answer Correct ?    1 Yes 3 No

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

Answer / owen

-- I believe the questionner wants the 5th row
-- (only) from the data.
-- I also assume we don't have a useful ID to work with.
-- This is one way of doing it without cursors:

select top 1 <fieldname>
from <TableName>
where <fieldname> not in
(select top 5 <fieldname>
from <TableName>)

-- NB Changing the "5" in the subquery above sets which
-- row number is returned

Is This Answer Correct ?    0 Yes 2 No

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

Answer / ashim pal

set rowcount 5

select * from table_name

Is This Answer Correct ?    7 Yes 16 No

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

Answer / ritu saini

SELECT TOP 5 column FROM table
ORDER BY NEWID()

Is This Answer Correct ?    14 Yes 25 No

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

Answer / sruthi

select top5 * from table
minus
select top4 from table

Is This Answer Correct ?    5 Yes 19 No

Post New Answer

More SQL Server Interview Questions

How to reaname table name without using sp_Rename in sql server..?

0 Answers   Wipro,


What is GUID in sql server?

0 Answers   BirlaSoft,


How many categories of data types used by sql server?

0 Answers  


Do you know what are the steps to process a single select statement?

0 Answers  


difference between function and procedure

3 Answers   Cognizant, HCL, TCS, Theorem,






What is inline variable assignment?

0 Answers  


What is raid and what are different types of raid levels?

0 Answers  


what operator performs pattern matching?

2 Answers  


How to truncate the log in sql server 2012? : sql server database administration

0 Answers  


how can you check the level of fragmentation on a table? : Sql server administration

0 Answers  


explain databases and sql server databases architecture? : Sql server database administration

0 Answers  


Tell me what is the significance of null value and why should we avoid permitting null values?

0 Answers  


Categories