SQLite Forum

3.31.1: create table with multiple primary key columns
Login
That only allows the deferral of the foreign key constraint check to commit time.  It does not permit the addition of a child without a parent.  To have an "orphan" child the referent is NULL.

eg:
```
create table parent(id integer primary key);
create table child(id integer primary key, parent references parent(id));
insert into parent default values;
insert into child values (2, 1);
insert into child values (3, null);
insert into child values (5, 2);
-- Error: FOREIGN KEY constraint failed
select * from parent;
-- 1
select * from child;
-- 2|1
-- 3|
```
or, for example:
```
create table parent(id integer primary key);
create table child(id integer primary key, parent references parent(id) on delete set null);
insert into parent default values;
insert into child values (2,1);
select * from parent;
-- 1
select * from child;
-- 2|1
delete from parent where id == 1;
select * from child;
-- 2|
```