Foreign key support

Foreign keys are an important feature in modern database design, to enforce database integrity:
CREATE TABLE orders (
   ... ,
   FOREIGN KEY(ord_customer) REFERENCES customer(cust_num) )
  )

SQLite (3.7) implements foreign key support, but this feature is not enabled by default. In fact, the FOREIGN KEY syntax does not raise an SQL error, but it has no effect.

Solution

In order to turn on foreign key constraints in SQLite 3.7, you must issue a PRAGMA command:
PRAGMA foreign_keys = ON;

Future releases of SQLite might change so that foreign key constraints enabled by default.