Evening all
I have been working on a small application but kind of stuck at the SQLite foreign key constraint. Basically what i have is one \"HostLookuptable\" as
<You cannot mix table columns and table constraints; the constraints must be listed after all the columns:
CREATE TABLE tblScanHistory (
ScanHistoryID INTEGER PRIMARY KEY AUTOINCREMENT,
HostID INTEGER,
ScanID INTEGER,
FOREIGN KEY(HostID) REFERENCES tblHostLookup(HostID),
FOREIGN KEY(ScanID) REFERENCES tblScanLookup(ScanID)
);
Or, simpler:
CREATE TABLE tblScanHistory (
ScanHistoryID INTEGER PRIMARY KEY AUTOINCREMENT,
HostID INTEGER REFERENCES tblHostLookup(HostID),
ScanID INTEGER REFERENCES tblScanLookup(ScanID)
);