Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR 1265 (01000): Data truncated for column

Tags:

mysql

Hello i am a student and not familiar with MySQL. I am new in mysql and i need help! I have a database and have some troubles inserting data into one table. The table name is makina

 CREATE TABLE `makina` (
  `lloji` varchar(20) DEFAULT NULL,
  `vitprodhimi` int(9) DEFAULT NULL,
  `ngjyra` enum('bardhe','blu','kuqe','zeze') DEFAULT 'bardhe'
) ENGINE=InnoDB DEFAULT CHARSET=latin1

And for the column ngjyra i doesn't accept the value red.

like image 743
Metjus Hoxha Avatar asked Nov 25 '25 07:11

Metjus Hoxha


1 Answers

The error is because of ENUM data type, it accept only your specific values.

Read more on The ENUM Type

If you want to accept more values you should alter your table : How do I add more members to my ENUM-type column in MySQL?

ALTER TABLE
    `makina`
MODIFY COLUMN
    `ngjyra` enum(
        'existing_value1',
        'existing_value2',
        'existing_value3',
        'existing_value4',
        'new_value1',
        'new_value2'
    )
DEFAULT  `bardhe`;
like image 159
Ergest Basha Avatar answered Nov 26 '25 22:11

Ergest Basha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!