Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate data in SQL

I have to keep duplicate data in my database so my question is...Is it preferable to keep the duplicate data in the same table and just add a column to identify the original data or I have to create another table to hold the copied data?

like image 246
Michael Fikry Avatar asked Sep 01 '26 14:09

Michael Fikry


1 Answers

I suggest to save the duplicate data in a different table or even a different schema so it won't be confusing to keep working with this table.

Imagine yourself in six months form now trying to guess what are all this duplicate rows for.

In addition those duplicate rows does not reflect the business purpose of this table. It will be nicer to store them in a table named [table_name]_dup or a schema named [schema_name]_dup

like image 169
AvielNiego Avatar answered Sep 04 '26 02:09

AvielNiego



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!