I have a person table in my database, which I define as follows:
CREATE TABLE 'persona' (
'documento' bigint(20) NOT NULL,
'nombres' varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
'apellidos' varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
'telefono' varchar(23) COLLATE utf8_unicode_ci NOT NULL,
'direccion' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
'username' varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY ('documento'),
KEY 'username' ('username')
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
And when I try to do a insert
like this:
INSERT INTO 'persona' ('documento', 'nombres', 'apellidos', 'telefono', 'direccion', 'username')
VALUES ('88668', 'theth', 'thetn', '2256', 'thrther', 'juancho')
I get the following error message:
Error # 1062 - Duplicate entry '0' for key 'PRIMARY'
Why does that happen and how can I solve it?