要删除重复数据,可以使用以下方法之一:
CREATE TABLE new_table AS
SELECT DISTINCT * FROM original_table;
DROP TABLE original_table;
ALTER TABLE new_table RENAME TO original_table;
WITH cte AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY column1, column2, ... ORDER BY column1) AS rn
FROM original_table
)
DELETE FROM cte WHERE rn > 1;
DELETE FROM original_table
WHERE (column1, column2, ...) IN (
SELECT column1, column2, ...
FROM original_table
GROUP BY column1, column2, ...
HAVING COUNT(*) > 1
);
以上方法需要根据具体的数据库系统和表结构进行调整。在执行删除操作之前,建议先备份数据以防止意外情况的发生。