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 is the difference between count(*) and count(1) ?
what stored procedure can you use to display the current processes? : Sql server administration
Explain primary key, foreign key and unique key?
Explain triggers?
What is sql server schema compare? How we can compare two database schemas?
Define inner join in sql server joins?
Give a example to search fr a string in all stored procedure in sql server.
What is replace and stuff function in sql server?
How do I make a resultset scrollable?
Can we check locks in database? If so, how can we do this lock check?
How to find the version of sql server? : sql server database administration
What do you mean by an execution plan? Why is it used? How would you view it?
How can a user-defined datatype be created?
How is sql server used?
What is the exact numeric data type in sql?