0
String query = "CREATE TABLE IF NOT EXISTS platforms ( " +
                   "id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, " +
                   "sites_id INTEGER UNSIGNED NOT NULL, " +
                   "baseline BLOB NULL, " +
                   "platform BLOB NULL, " +
                   "siteinfo BLOB NULL, " +
                   "databases BLOB NULL, " +
                   "PRIMARY KEY(id), " +
                   "INDEX (sites_id), " +
                   "FOREIGN KEY (sites_id) " +
                     "REFERENCES sites (id) " +
                        "ON DELETE NO ACTION " +
                        "ON UPDATE NO ACTION " +
                   ")ENGINE=InnoDB;";

this is the SQL query for a MySQL database I'm trying to create. However, I don't know why, I'm getting the following error:

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databases BLOB NULL, PRIMARY KEY(id), INDEX (sites_id), FOREIGN KEY (sites_id) R' at line 1"

Could someone please point out for what is the problem?

1 Answer 1

3

DATABASES is a reserved word. Quote it by using the backtick ` character:

`databases` BLOB NULL
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.