# DB Tables and Unique or duplicate values

**URL:** <https://forum.inductiveautomation.com/t/db-tables-and-unique-or-duplicate-values/39678>\
**Category:** Ignition\
**Created:** [October 14, 2020, 6:38pm UTC](https://forum.inductiveautomation.com/t/db-tables-and-unique-or-duplicate-values/39678 "2020-10-14T18:38:56Z")\
**Posts on this page:** 1\
**Showing post:** 29

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 16, 2020, 7:47pm UTC](https://forum.inductiveautomation.com/t/db-tables-and-unique-or-duplicate-values/39678/29 "2020-11-16T19:47:57Z")

</div>

You can follow this method I outline in another post after you make the UNIQUE indexes

> [@Insert into database only if the entry doesn't exist](http://forum.inductiveautomation.com/t/insert-into-database-only-if-the-entry-doesnt-exist/35122/2):
>
> There are two ways to do this - check for a duplicate manually with python before inserting, and if there’s a problem show the screen Make UNIQUE INDEX definitions on your table in the database, and then just try/except inserting into it. Personally I like to leave data integrity to the database where appropriate, and ensuring UNIQUE-ness is one of those times in my opinion. I use this method for a MySQL DB and it looks like this in practice. My personal solution would be to make your n…

---

_[View the full topic](https://forum.inductiveautomation.com/t/db-tables-and-unique-or-duplicate-values/39678)._
