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
Explain different types of collation sensitivity?
What is the difference between MVC and Teir Architecher? Plz explain with Layyered Programming example...? Thanks
How to list all login names on the ms sql server?
What are the new features introduced in SQL Server 2000? What changed between the previous version of SQL Server and the current version?
On a windows server 2003 active – passive failover cluster, how do you find the node which is active?
What are the types of indexing?
What is model database? : SQL Server Architecture
Can we insert data into view sql server?
How to test a dml trigger in ms sql server?
Name some of the open source software that you can use in alternative to SSR?
What is the recursive stored procedure in sql server?
What is difference between oltp and olap?
can you implement data mining in SSRS?
What is the difference function and stored procedure?
Suppose we have a table "MyTable" containing 10 rows, what query should be executed to update the odd rows "Salary" as 9000?