在mysql建表中,sql语句'shopSex' enum("男","女","保密") not null de

MySql 码拜 8年前 (2016-09-17) 1117次浏览
在mysql建表中,sql语句”shopSex” enum(“男”,”女”,”保密”) not null default “保密”,老是提示冲突,怎么解决?
mysql语句如下:
drop table if exists “tb_shop”;
create table “tb_shop”(
“shopId” int unsigned auto_increment key,
“shopName” varchar(20) not null unique,
“shopPW” varchar(20) not null,
“shopSex” enum(“男”,”女”,”保密”) not null default “保密”,
“shopEmail” varchar(50) not null,
“shopAddTime” int unsigned not null
);
解决方案

4

按照你的建表语句没问题,运行成功
贴出你的错误提示
另外 注意你贴出来的单引号是不能用在表名和字段名
你可以删除表名和字段名的单引号 再试试

8

不建议用汉字存储到数据库,最好用数字或字母代替性别,数据取出时,在转换成性别
你的SQL是用引号囊括字段和数据表的,如‘table’,应该用上浮点,如`table`,在键盘的Tab键上面那个

8

楼上正解,性别 ,最多就 那三个值,在页面直接写死,在数据库中存放int ,类型,页面使用时“翻译一下” ,另外建议手动将 “  · ”  (键盘的Tab键上面)全部替换为空 ,避免一些不必要的错误 !

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明在mysql建表中,sql语句'shopSex' enum("男","女","保密") not null de
喜欢 (0)
[1034331897@qq.com]
分享 (0)