暂无图片
sqlite 指定外键后,这个字段可不可以为空?
我来答
分享
暂无图片 匿名用户
sqlite 指定外键后,这个字段可不可以为空?

就是要么为空,要么有一个外键

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
严少安
暂无图片

sqlite 指定外键后,这个字段可以为空。

# 先打开外键 sqlite> PRAGMA foreign_keys; 0 sqlite> PRAGMA foreign_keys = ON; sqlite> PRAGMA foreign_keys; 1 # 测试 create table t1 (id int primary key not null); create table t2 (id int, pid int, name int, foreign key (pid) references t1(id) on delete no action on update no action); insert into t1 select 1; insert into t2 select 1,1,1; insert into t2 select 1,null,1; sqlite> select * from t2; 1|1|1 1||1
暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏