MySQL
- error: BLOB/TEXT column ‘XXX’ used in key specification without a key length, 又不想改列的类型的话,直接限制列名长度
alter table devicetype add index XXX (XXX(100));
换成varchar
alter table 表名 modify column 字段名 类型 - 为创建好的表加主键
ALTER TABLE <数据表名> ADD PRIMARY KEY(<列名>); - 唯一约束
alter table 表名 add constraint 约束名(随意起) unique(列名)