First of all, determine which fields in the table should be unique. It could be something marked as a primary key, a unique index based on one or more fields or a control constraint, again based on one or more fields.
Once you do this, look at what you are trying to insert and work out, whether it violates any unique rules.
And yes, SELECT statements will help you determine what is wrong here. Use them to determine if you can commit the row.
source
share