I want to use ENUM feature in table using MySQL.
I have created a table tbl_test having id as primary key and enum_col field as ENUM data type.
CREATE TABLE tbl_test(
id INT NOT NULL AUTO_INCREMENT,
enum_col ENUM('a','b','c') NOT NULL,
PRIMARY KEY ( id )
Data truncated for column 'enum_col' at row 1
INSERT INTO tbl_test(id, enum_col) values(1, 'a');
INSERT INTO tbl_test(id, enum_col) values(2, 'a,b');
That is because you can only store one value in it and in fact you absolutely should store only one value in whatever type of column.
Use a seperate table. Then you can store as much values as you like with multiple records. Example:
tbl_test -------- id | name 1 | test_X 2 | test_Y 3 | test_Z tbl_test_enums -------------- test_id | enum_value 1 | a 1 | b 2 | a 3 | c