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 are the default system databases in sql server 2000?
Why do we use sql limitations? Which constraints can we use while making a database in sql?
Why truncate is ddl?
What is the difference between stored procedure and user defined functions?
What is forward - only cursors / read only cursor?
How to assign new column names in a view?
Explain transaction server distributed transaction?
Which command is used for user defined error messages?
What is the difference between ddl and dml?
What is named query? : sql server analysis services, ssas
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?
What are the differences between clustered and non-clustered index?
What are pages and extents? : SQL Server Architecture
How column data types are determined in a view?
what is a check constraint?