Error Code: 1136. Column count does not match value count at row 1

0

I am trying to insert data into a table, but I am not getting it, giving this error: "Error Code: 1136. Column count does not match value count at row 1.", does anyone know how to solve? >

I've 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;

So I tried to insert it:

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 having described the fields so I tried it like this:

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.

    
asked by anonymous 24.04.2018 / 21:14

1 answer

1

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