How to remove duplicate rows from a table?.
Answers were Sorted based on User's Feedback
Answer / vamsi
for example our emp table have duplicate rows than we can
run this query to delete those duplicate rows
Delete from emp a
where rowid <> ( select max(rowid) from emp where empno =
a.empno);
| Is This Answer Correct ? | 13 Yes | 4 No |
Answer / lova raju allumalla
delete from emp where rowid not in (select min(rowid) from
emp group by empno);
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / karthik
with [dup_cte] as {
select row_number(partition by eid order by eid) as rn from emp}
go
delete from [dup_cte] where rn>1
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the constraints available in sql?
How will you select unique values from a list of records?
How many triggers can be implemented for a table?
What is compound trigger?
What is a primary key called that is made up of more than one field?
how to decrement dates by 1 in mysql? : Sql dba
How does a covering index work?
What is a constraint? Tell me about its various levels.
What is the purpose of the sql select top clause?
is mysql query is case sensitive? : Sql dba
What are the advantages of VIEW?
what is cursor and its type, what is ref cursor write a syntax to pass ref cursor into procedure out fucntion and call the procedure
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)