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

前端 未结 7 1344
自闭症患者
自闭症患者 2020-12-02 08:05

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. W

7条回答
  •  情书的邮戳
    2020-12-02 08:18

    FYI: A useful simulation tool - phpMyAdmin with Wampserver 3.0.6 - Preview SQL: I use 'Preview SQL' to see the SQL code that would be generated before you save the column with the change to ENUM. Preview SQL

    Above you see that I have entered 'Ford','Toyota' into the ENUM but I am getting syntax ENUM(0) which is generating syntax error Query error 1064#

    I then copy and paste and alter the SQL and run it through SQL with a positive result.

    SQL changed

    This is a quickfix that I use often and can also be used on existing ENUM values that need to be altered. Thought this might be useful.

提交回复
热议问题