NOT NULL constraint
Here we have two tables. In the restricted table we set one of the fields to be NOT NULL.
CREATE TABLE plain (
id INTEGER,
name TEXT
);
INSERT INTO plain (id, name) VALUES (1, 'Joe');
INSERT INTO plain (name) VALUES ('Jane');
SELECT * from plain;
CREATE TABLE restricted (
id INTEGER NOT NULL,
name TEXT
);
INSERT INTO restricted (id, name) VALUES (1, 'Joe');
INSERT INTO restricted (name) VALUES ('Jane');
INSERT INTO restricted (id, name) VALUES (NULL, 'Mary');
SELECT * from restricted;
$ sqlite3 < examples/not-null.sql
1|Joe
|Jane
Error near line 18: NOT NULL constraint failed: restricted.id
Error near line 19: NOT NULL constraint failed: restricted.id
1|Joe