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 ?
Qjay last edited by
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 .
Maybe its called create index ?
the_ last edited by
As far as I remember, it is not possible to create indices within a
create tablestatement in sqlite. So you have to split this into the
create tableand the
create indexstatement as mentioned by @mrjj