我希望能够从军官表中删除一名军官,并且这样做会自动删除调查表中的军官调查。我的代码看起来是正确的,但它只会从人员表中删除官员,而不是从调查表中删除。有人可以告诉我我做错了吗?
queryCurs.execute('PRAGMA foreign_keys = ON')
queryCurs.execute('''CREATE TABLE Cases
(CID INTEGER PRIMARY KEY, Type TEXT, Description TEXT, Location TEXT, Ward INT)''')
queryCurs.execute('''CREATE TABLE Officers
(OID INTEGER PRIMARY KEY, Name TEXT, Team TEXT)''')
queryCurs.execute('''CREATE TABLE Investigation
( CID INTEGER, OID INTEGER REFERENCES Officers(OID) ON DELETE CASCADE, DateInvolved DATE)''')
queryCurs = conn.cursor()
queryCurs.execute('''DELETE FROM Officers WHERE OID = 1''')
createDb.commit()
createDb.close()