Error Code: 1136. Column Count doesn’t match value Count at Row 1

Asked

Viewed 13,106 times

1

I’m trying to insert data into a table, but I’m not getting it, giving the following error: "Error Code: 1136. Column Count doesn’t match value Count at Row 1.", someone knows how to solve?

I created the following table:

create table pessoas (
cpf int (11),
nome varchar(30) not null,
nascimento date,
endereco varchar(30) not null,
cep int(7),
bairro varchar(20),
cidade varchar(30),
uf char (2),
ultima_compra date,
primary key(cpf)
)default charset = utf8;

There I am tried to make the Insert:

insert into pessoas values
('04496332780', 'João da Silva', '25-11-1969', 'Rua Antônio Numes', '88045963', 'Palmeiras','Londrina', 'PR','24-04-2018');

I thought it might be some mistake for not describing the fields I tried that way:

insert into pessoas (cpf, nome, nascimento, endereco, cep, bairro, cidade, uf) values
('04496332780', 'João da Silva', '25-11-1969', 'Rua Antônio Numes', '88045963', 'Palmeiras','Londrina', 'PR','24-04-2018');

But the result was the same.

1 answer

2

In your SQL statement in the description of the fields there are 8 fields "cpf, nome, nascimento, endereco, cep, bairro, cidade, uf)" and in the place of values there are 9 values "('04496332780', 'João da Silva', '25-11-1969', 'Rua Antônio Numes', '88045963', 'Palmeiras','Londrina', 'PR','24-04-2018');". The field description is missing ultima_compra in the description of the fields.

The SQL statement should look like this:

insert into pessoas (cpf, nome, nascimento, endereco, cep, bairro, cidade, uf, ultima_compra) values ('04496332780', 'João da Silva', '25-11-1969', 'Rua Antônio Numes', '88045963', 'Palmeiras','Londrina', 'PR','24-04-2018');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.