On utilisera le site https://sqliteonline.com/
CREATE TABLE Tab(
attribut1 INT,
attribut2 TEXT,
attribut3 INT NOT NULL,
attribut4 INT PRIMARY KEY
)
DROP TABLE nom_table
INSERT INTO Tab
VALUES
(0,"test"),
(2,2020)
A la création de la table il faut rajouter :
FOREIGN KEY(attribut) REFERENCES AutreTab(autre_attribut)
Pour SQLite il faut lancer cette commande avant d'utiliser les clefs étrangères :
PRAGMA foreign_keys = ON;
FOREIGN KEY(attribut) REFERENCES AutreTab(autre_attribut) ON DELETE CASCADE
FOREIGN KEY(attribut) REFERENCES AutreTab(autre_attribut) ON DELETE RESTRICT