Brian Dunning's Error Code Reference

MySQL Error 1062

SQLSTATE: 23000 (ER_DUP_ENTRY) Duplicate entry '%s' for key %d

 

Comments

Anony Mous   Anony Mous, Pro Computer
Dec 6, 2007
1062 is a common constraint error indicating an attempt to insert a duplicate value into a column with UNIQUE INDEX or PRIMARY KEY INDEX. For example; when a table named 'account' has a column named 'company_name' and that column has a UNIQUE INDEX (values for 'company_name' must be unique) MySQL throws error 1062 when an attempt is made to insert a record with a value for 'company_name' column that already exists in the 'account' table.