我正在尝试使用以下查询将 gender
列添加到我的表中:
ALTER TABLE QRCodeUser ADD gender CHAR(1) enum('M','F') NOT NULL;
我收到这个错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'enum('M','F') NOT NULL' at line 1
我的错误是什么?
最佳答案
试试这个(你不需要指定大小,char(1)
):
ALTER TABLE QRCodeUser ADD gender enum('M','F') NOT NULL;
关于mysql - 向现有表添加新的枚举列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30139813/