I added a record in a table in MySQL database, now I am trying to delete that particular record from table, but it is not getting deleted & showing this message:
#1062 - Duplicate entry '3107' for key 'PRIMARY'
How do I delete this entry?
I added a record in a table in MySQL database, now I am trying to delete that particular record from table, but it is not getting deleted & showing this message:
#1062 - Duplicate entry '3107' for key 'PRIMARY'
How do I delete this entry?
You can not get this error during DELETE
. UPDATE or INSERT can return that
So either you are not running DELETE
or you have trigger on your table, that is making some other changes, that give you that error.
If child tables have ON DELETE CASCADE
,check them for triggers as well.
delete from table_name [where condition];
use this statement, replace table_name
with your table name and put the condition.
If you do not specify where
clause, every records will be deleted.