我有以下结构:(抱歉,尴尬的名字,这是因为它是一个sqlite数据库为我的iPhone应用程序,还没有发布)
原文链接:https://www.f2er.com/sqlite/198097.htmlCREATE TABLE klb_log ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,log_comment varchar(512) ) CREATE TABLE klb_log_food_maps ( uid integer,did integer,PRIMARY KEY (uid,did),FOREIGN KEY (uid) references klb_log(id) ON DELETE CASCADE,FOREIGN KEY (did) references klb_food(id) ON DELETE CASCADE ) CREATE TABLE klb_food ( id integer,description varchar(255),PRIMARY KEY (id) )