Last answered:

14 Jul 2022

Posted on:

08 Jul 2022

0

Resolved: Error code 1265. Data truncated for column 'gender' at row 1

Hello! When I try to add Peter, figaro, m into a column, I keep getting Error Code: 1265. Data truncated for column 'gender' at row 1. I'm not sure what that means or what I am doing wrong:

Here are all of the queries I have recently ran for the customers table. They all seem to be the same but I keep getting an error when trying to add the values:

create table customers
(
customer_id int auto_increment,
first_name varchar(255),
last_name varchar(255),
email_address varchar(255),
number_of_complaints int,
primary key (customer_id)
);
alter table customers
add column gender enum('m''f') after last_name;
alter table customers
change column number_of_complaints number_of_complaints int default 0;
insert into customers (first_name, last_name, gender)
values ('Peter', 'Figaro', 'm')
;

1 answers ( 1 marked as helpful)
Instructor
Posted on:

14 Jul 2022

0

Hi Shelly!
Thanks for reaching out.

You omit the comma (,) between the arguments. Please, use the following code:

ALTER TABLE customers
ADD COLUMN gender ENUM('m','f') AFTER last_name;



Hope this helps.
Best,
Tsvetelin

Submit an answer