Andy Kurniawan
Andy Kurniawan

Reputation: 11

Error 1062 duplicate entry '0' for key 'primary'

can't add primary key for ID table and how to fix it?

https://i.sstatic.net/Mj4I0.png

Upvotes: 0

Views: 528

Answers (1)

Spencer Bard
Spencer Bard

Reputation: 1035

It seems as though you have multiple rows in the table that have id = 0.

In order to add the primary key to the table you'll need to either delete those duplicate rows or update their id fields to be a unique value.

Upvotes: 3

Related Questions