if 3 duplicate records in a table,i want to delete 2 duplicate
records by keeping 1 as it is,how?
Answer Posted / venkat
if u r table like this
sno sname fee
1 a 1000
1 a 1000
2 b 1000
2 b 1000
3 c 1000
3 c 1000
--- write this
with duplicatecte
as
(select row_number()over(partition by sno,sname order by fee
)as rnum from students )
delete from dupcte where rnum>1
---run this query
select * from students
--out put is
1 a 1000
2 b 1000
3 c 1000
this is correct
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Differentiate between SQL and ORACLE joins and write their syntax.
What is @@error in sql?
What are the new features introduced in SQL Server 2000? What changed between the previous version of SQL Server and the current version?
Do you know what are the ways available in sql server to execute sql statements?
Give an example of why you would want to denormalize a database
Explain view in sql server?
Explain system functions or built-in functions? What are different types of system functions?
What are different types of raid configurations? : SQL Server Architecture
Would you store your query in a ssrs report or a database server? State the reason why?
What is the default schema of your login session in ms sql server?
What is normalization 1nf 2nf 3nf?
Explain trigger and its types?
What are the pros and cons of putting a scalar function in a queries select list or in the where clause?
Difference between drill down and drill through report.
Explain the various types of concurrency problem?