mysql 关于datetime的问题

1.在mysql中我建了一个formone表,其中CreateTime字段的类型为Datetime,长度为4,我可以这样写吗 CreateTime CreateTime(4)not null,
2.我在表里设置一字段Address carchar型20长度 字段含义为IP,这样写为什么提示错误 Address carchar(20)not null comment 'ip', carchar这个类型在mysql中有什么限制吗?
谢谢!!!

首先,字段类型你写成了CreateTime,应该是Datetime,另外,Datetime类型不需设字段长度

CreateTime CreateTime(4)not null

其次mysql中无carchar类型,只有varchar,是不是搞错了啊

Address carchar(20)not null comment 'ip'
温馨提示:答案为网友推荐,仅供参考
相似回答