ERROR 1264: 1264: Out of range value for column 'cpf' at row 1 SQL Statement

1

I have a problem with MySQL, 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),
primary key(cpf)
)default charset = utf8;

I've added a column:

alter table pessoas
add column ultima_compra date;

I tried to do the following insert:

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

And gave this error:

  

ERROR 1264: 1264: Out of range value for column 'cpf' at row 1   SQL Statement: **

    
asked by anonymous 16.04.2018 / 22:07

1 answer

-3

Your mistake was to create columns as Int and try to write varchar. Try removing quotation marks from cpf and cep:

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

* Editing (I did not really notice that it exceeded 10 digits): int accepts up to 10 digits. Create the table using the correct type:

bigint: -9.223.372.036.854.775.808 à 9.223.372.036.854.775.807
int:    -2.147.483.648 a 2.147.483.647
smallint    -32,768 a 32,767
    
16.04.2018 / 22:15