how do we find every fifth record in a table
Answer Posted / 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 |
Post New Answer View All Answers
What do you understand by integration services in sql server?
How to create a large table with random data for index testing in ms sql server?
How to start sql server browser service?
Describe the functionalities that views support.
You want to use bids to deploy a report to a different server than the one you chose in the report wizard. How can you change the server url?
Why do we use non clustered index?
what purpose does the model database serve? : Sql server database administration
What does it mean if @@cursor_row returns a negative number?
What is the function of inner join?
tell me the disaster recovery plan
Explain trigger classes i.e. Instead of and after trigger?
How can you set the threshold at which sql server will generate keysets asynchronously?
explain databases and sql server databases architecture? : Sql server database administration
What is scan table/view and seek table/view when its occurs? : sql server database administration
What is BCP? When does it used in sql server 2012?