2012-05-30 206 views
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;"; 

這是一個MySQL數據庫我試圖創建SQL查詢。但是,我不知道爲什麼,我發現了以下錯誤:MySQL的外鍵創建表

"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"

可能有人請指出的是什麼問題?

回答