PRAGMA
A SQLite statement that reads or changes a setting of the database library or of the current connection.
In more detail
PRAGMA foreign_keys = ON turns on foreign key enforcement, which SQLite leaves off by default for backward compatibility. The setting belongs to the connection, not the file, so every connection your application opens must set it. Only SQLite has it; PostgreSQL has no equivalent because it always enforces foreign keys.
Example
PRAGMA foreign_keys = ON;Related terms
- foreign key — A column holding another table's primary key value, which the database guarantees points at a row that exists.
- SQLite — A small relational database that runs as a library inside your program and keeps the whole database in one file.
- connection — An open session between a program and a database, through which it sends statements and receives results.
Taught in
- Asset Lifecycle Management & Media Sanitization — Cybersecurity Fundamentals, GRC & Cryptography
- Why Tables And Relations Beat Files — PostgreSQL, Indexing & Relational Data Modeling
- Keys, Constraints And Referential Integrity — PostgreSQL, Indexing & Relational Data Modeling
- Where PostgreSQL Differs From SQLite — PostgreSQL, Indexing & Relational Data Modeling