3

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.

1 Answers1

3

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`;
Ergest Basha
  • 7,870
  • 4
  • 8
  • 28