Inserting and querying data from table with foreign key in SQLite
问题 I wanted to create two related tables. My query that is creating tables looks like this: static final String SQL_CREATE_TABLE_LISTS = "CREATE TABLE Lists(Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT);"; static final String SQL_CREATE_TABLE_ITEMS = "CREATE TABLE Items(IdList INTEGER, ItemName TEXT, FOREIGN KEY(IdList) REFERENCES Lists(Id));"; I want now insert and select some data from table Items, but I do not know how the query should looks like. Lets say I have one record in table Lists: