I don't see what you mean by second "sqlite3" command. What you wrote appears to be a 3rd argument to the original "sqlite3" command(?) which results in this as expected: Error: near "sqlite3": syntax error I've managed a minimal test case though: DROP TABLE IF EXISTS a; CREATE TABLE a(ID INTEGER NOT NULL PRIMARY KEY); DROP TABLE IF EXISTS b; CREATE TABLE b( ID INTEGER NOT NULL PRIMARY KEY, c_ID INTEGER REFERENCES c(ID), a_ID INTEGER NOT NULL REFERENCES a(ID) ON DELETE CASCADE ); DROP TABLE a; The above produces the following: Error: near line 11: no such table: main.c If you remove the "ON DELETE CASCADE" then the error goes away.