gpt4 book ai didi

mysql - 向现有表添加新的枚举列

转载 作者:可可西里 更新时间:2023-11-01 06:31:28 24 4
gpt4 key购买 nike

我正在尝试使用以下查询将 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com