0

A dumb question, but I can't find a error here...

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

SQLite says:

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]

What is the error?

1 Answer 1

1

My guess would be missing comma before UNIQUE:

CREATE TABLE units (
    _id INTEGER PRIMARY KEY AUTOINCREMENT,
    group_id INTEGER NOT NULL,
    unit_name STRING NOT NULL,
    UNIQUE (group_id, unit_name)
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.