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...


how do we find every fifth record in a table

Answers were Sorted based on User's Feedback



how do we find every fifth record in a table..

Answer / krishans

SELECT RowNumber from ( Select ROW_NUMBER() OVER (order by
EmployeeID)as RowNumber
FROM Employee) as x
where x.RowNumber % 5 = 0

Is This Answer Correct ?    9 Yes 3 No

how do we find every fifth record in a table..

Answer / jahir

Select Top 1 * From (Select Top 5 * From Employee Order By
1 Asc) As X Order By 1 Desc

Is This Answer Correct ?    8 Yes 2 No

how do we find every fifth record in a table..

Answer / saravanan p

If we consider employee2 table having 16 records like

Name Salary
Ajith 10000
Arithas 2000
Balaji 20000
Gamesh 20000
Jith 23000
keerthy 14000
boopathy 21000
moorthy 12000
Muthu Krishnan 30000
Muthu Kumar 80000
naveen 10200
neerthy 40000
Raja 12000
Ramesh 12000
sangeeth 1100
Vairam 23000


With Temp as
(
select row_number() over(order by [name]) as 'rno',
[name] from employee2
)
select [name],salary from Temp
where rno%5 = 0


The result..

Name Salary
Jith 40000
Muthu Kumar 15000
sangeeth 50000

Is This Answer Correct ?    1 Yes 0 No

how do we find every fifth record in a table..

Answer / srivatsa p

Select Top 1 * From (Select Top 5 * From customers Order By
1 Asc) X Order By 1 Desc

Is This Answer Correct ?    4 Yes 4 No

how do we find every fifth record in a table..

Answer / saurabh tyagi

select id ,partcode from prt where id in
(

select case when row_number() over (order by partcode ) %
5 = 0
then row_number() over (order by
partcode)
else 0 end
from prt
)

Is This Answer Correct ?    0 Yes 0 No

how do we find every fifth record in a table..

Answer / divya mahendra sikarwar

Select Top 1 * From (Select Top 5 * From customer Order By
1 Desc) As X

Is This Answer Correct ?    2 Yes 2 No

how do we find every fifth record in a table..

Answer / vicky

Assuming there are 3 columns in the table emp1

select id, name ,salary from ( select id,name ,salary,
mod(rownum,5) as r from emp1) where r=0

Is This Answer Correct ?    0 Yes 0 No

how do we find every fifth record in a table..

Answer / shanmugam

with cte as(
select ROW_NUMBER() over (order by id) as serial,* from tablename
)
select * from cte where serial=5

Is This Answer Correct ?    0 Yes 0 No

how do we find every fifth record in a table..

Answer / avinash

SELECT employeeID from ( Select ROW_NUMBER() OVER ( order by id )as RowNumber,employeeID FROM Employee ) as x where x.RowNumber % 5 = 0

Is This Answer Correct ?    0 Yes 0 No

how do we find every fifth record in a table..

Answer / nataraj m

select * from employees where eid = (select max(eid) from
employees where eid in (select top 5 * from employees))

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More SQL Server Interview Questions

what is the main difference between after trigger and instead trigger.

2 Answers  


Name the different type of indexes in sql?

0 Answers  


I have to display ten columns values from diffrent ten tables. how many joins are require?

10 Answers   CarrizalSoft Technologies, HCL,


What happens when converting big values to numeric data types?

0 Answers  


What are the rules to use the rowguidcol property to define a globally unique identifier column?

0 Answers  


Explain the etl (extraction, transformation, and loading)?

0 Answers  


if 3 duplicate records in table,i want to delete 2 alternating duplicate records by keeping 1 duplicate and 1 original as it is,how?

2 Answers  


can a table be moved to different filegroup? : Sql server administration

0 Answers  


Does any body please help me what question's have asked for SSRS in the interview?

0 Answers  


Write a program to fetch first 10 records from a file?

0 Answers   Amdocs,


You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?

0 Answers  


What is Report Server,Report Manager and Report Builder in SSRS 2005?

1 Answers  


Categories