I15*_*159 19 sql sqlite ddl unique-index
我需要为现有表添加唯一的字段索引.我做了这一行:
ALTER TABLE auth_user ADD UNIQUE INDEX (email);
表和字段已经存在.错误是:
查询错误:接近"UNIQUE":语法错误无法执行语句
我错过了什么?它对SQLite3有什么具体要求吗?
Adr*_*iro 45
CREATE UNIQUE INDEX IF NOT EXISTS MyUniqueIndexName ON auth_user (email)
另外,阅读官方手册:
http://www.sqlite.org/lang_createindex.html