Turning integrity on in SQL
SQLite only enforces foreign keys when you ask it to, once per connection.
PRAGMA foreign_keys = ON;
PRAGMA foreign_key_list('orders');
PRAGMA foreign_key_check;
PRAGMA integrity_check;
PRAGMA table_info('orders');
How it works
PRAGMA foreign_keys = ONis per connection and off by default.foreign_key_checklists rows that already point at nothing.integrity_checkverifies the file's own structure.
Keywords and builtins used here
ON
The run, in numbers
- Lines
- 9
- Characters to type
- 143
- Tokens
- 23
- Three-star pace
- 90 tpm
At the three-star pace of 90 tokens a minute, this run takes about 15 seconds.
Step 2 of 2 in Referential integrity, step 7 of 16 in Schema & constraints.