无法在sqlite中添加外键约束...........
答案 0 :(得分:7)
从SQLite 3.6.19开始,SQLite支持外键。您需要通过以下方式启用它们:
<强>源码&GT; PRAGMA foreign_keys = ON;
默认情况下,它们是为了向后兼容而关闭的。
有关详细信息,请参阅documentation。
答案 1 :(得分:1)
答案 2 :(得分:-1)
在sqlite 3中: 例子:
create table student (_id integer autoincrement primary key ,master_id integer);
create table master (_id integer autoincrement primary key , name varchar(30) );
select * from student where master_id in (select _id from master where name like '...')
不需要外键(master_id)引用master(_id); :)