1.Change your DB Settings enable to Foreign Keys.
2.Create the child table like this
table1 is the parent table having id1 as primary key.
CREATE TABLE "table1" ("id1" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)
table2 is the child table having id2 as a foreign key with reference to id1 of table1.
CREATE TABLE table2 (
id2 INTEGER,
parent_id INTEGER,
description TEXT,
FOREIGN KEY (id2) REFERENCES table1(id1)
)
Используйте equijoin для извлечения данных из таблиц.
select * from table1,table2 where table1.id1=table2.id2;
or
select table2.* from table2,table1 where table1.id1=table2.id2;
to retrieve the data from single table alone.
Надеюсь, это вам поможет!