Skip to content Skip to sidebar Skip to footer

Delete Duplicate Rows In Large Sqlite Table

I have a table of 10million rows I have duplicate rows and I've developed a column that concentrates several columns. This created column should be unique. So this is what I have

Solution 1:

This should be doable in pure SQL:

CREATE TABLE temp_table as SELECT DISTINCT * FROM source_table;
DELETE FROM source_table; 
INSERT INTO source_table SELECT * FROM temp_table

Solution 2:

delete from TABLE where id in (
    select TABLE.id from TABLE q1
      join TABLE q2 on q1.name = q2.name
    where q1.id < q2.id)

Post a Comment for "Delete Duplicate Rows In Large Sqlite Table"