Write a sql query to delete duplicate records from a table called table1
Answer / Vipin Sonkar
You can delete duplicate rows from a table in SQL Server using the ROW_NUMBER() window function:
```sql
WITH cte AS (
SELECT *,
ROW_NUMBER() OVER(ORDER BY YourColumn) as rownum
FROM Table1
)
DELETE FROM cte WHERE rownum > 1
| Is This Answer Correct ? | 0 Yes | 0 No |
What is bcnf normalization form?
What is index, cluster index and nonclustered index?
What is the difference between dropping a database and taking a database offline?
Define compound operators?
What is 'write-ahead log' in sql server 2000 ?
How will you decide the active and passive nodes?
What is an identity?
What is the difference between a Application Server and a Database
Why are views required in the sql server or in any other database?
How do I change my passwords (database, LDAP, and so on) without causing an outage?
one of my database size is 2gb and Unrestricted Growth for Data file up to 10%.But every day after day I am getting Primary Data file is full 99.999 please take appropriate actions.Why it is? Even disk space is also not full,but still I am getting the alerts.
Explain what is row_number function?
Oracle (3253)
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)