0

一个愚蠢的问题,但我在这里找不到错误......

CREATE TABLE units (_id INTEGER PRIMARY KEY AUTOINCREMENT, group_id INTEGER NOT NULL, unit_name STRING NOT NULL UNIQUE (group_id, unit_name))

SQLite 说:

SQLiteManager: Likely SQL syntax error: CREATE TABLE units (_id INTEGER PRIMARY KEY AUTOINCREMENT, group_id INTEGER NOT NULL, unit_name STRING NOT NULL UNIQUE (group_id, unit_name))
 [ near "(": syntax error ]
Exception Name: NS_ERROR_FAILURE
Exception Message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)  [mozIStorageConnection.createStatement]

错误是什么?

4

1 回答 1

1

我的猜测之前会缺少逗号UNIQUE

CREATE TABLE units (
    _id INTEGER PRIMARY KEY AUTOINCREMENT,
    group_id INTEGER NOT NULL,
    unit_name STRING NOT NULL,
    UNIQUE (group_id, unit_name)
)
于 2013-10-01T12:30:39.287 回答