LMSouq
database Open

How do I add more members to my ENUM-type column in MySQL?

ZA
Zaid
1 month ago
3 views
Problem Description
The MySQL reference manual does not provide a clearcut example on how to do this. I have an ENUM-type column of country names that I need to add more countries to. What is the correct MySQL syntax to achieve this? Here's my attempt: ALTER TABLE carmake CHANGE country country ENUM('Sweden','Malaysia'); The error I get is: `ERROR 1265 (01000): Data truncated for column 'country' at row 1.` The `country` column is the ENUM-type column in the above-statement. <b>SHOW CREATE TABLE</b> OUTPUT: mysql> SHOW CREATE TABLE carmake; +---------+---------------------------------------------------------------------+ | Table | Create Table +---------+---------------------------------------------------------------------+ | carmake | CREATE TABLE `carmake` ( `carmake_id` tinyint(4) NOT NULL AUTO_INCREMENT, `name` tinytext, `country` enum('Japan','USA','England','Australia','Germany','France','Italy','Spain','Czech Republic','China','South Korea','India') DEFAULT NULL, PRIMARY KEY (`carmake_id`), KEY `name` (`name`(3)) ) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=latin1 | +---------+---------------------------------------------------------------------+ 1 row in set (0.00 sec) <b> SELECT DISTINCT country FROM carmake</b> OUTPUT: +----------------+ | country | +----------------+ | Italy | | Germany | | England | | USA | | France | | South Korea | | NULL | | Australia | | Spain | | Czech Republic | +----------------+

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base