Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
What's wrong with this SQLite query ?
-
CREATE TABLE IF NOT EXISTS `Pages_has_Dependencies` ( `page_ID` INT NOT NULL, `depe_ID` INT NOT NULL, PRIMARY KEY (`page_ID`, `depe_ID`), INDEX `fk_Pages_has_Dependencies_Dependencies1_idx` (`depe_ID` ASC), INDEX `fk_Pages_has_Dependencies_Pages_idx` (`page_ID` ASC), CONSTRAINT `fk_Pages_has_Dependencies_Pages` FOREIGN KEY (`page_ID`) REFERENCES `Pages` (`page_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Pages_has_Dependencies_Dependencies1` FOREIGN KEY (`depe_ID`) REFERENCES `Dependencies` (`depe_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION);
Error that i am getting is :
QSqlError("1", "Unable to execute statement", "near \"INDEX\": syntax error")
Can anyone tell me what's wrong with this sql statements .
-
Hi
Maybe its called create index ?
http://www.tutorialspoint.com/sqlite/sqlite_indexes.htm
-
As far as I remember, it is not possible to create indices within a
create table
statement in sqlite. So you have to split this into thecreate table
and thecreate index
statement as mentioned by @mrjj