From b7ee8bb294a261f6137d10fa98e77c6a3d02ac37 Mon Sep 17 00:00:00 2001 From: Pierre Valarcher Date: Wed, 25 Sep 2024 10:51:58 +0200 Subject: [PATCH] Rajout TD2.sql --- Code/TD2.sql | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Code/TD2.sql diff --git a/Code/TD2.sql b/Code/TD2.sql new file mode 100644 index 0000000..69b3416 --- /dev/null +++ b/Code/TD2.sql @@ -0,0 +1,36 @@ +BEGIN TRANSACTION; +CREATE TABLE IF NOT EXISTS "Fournisseur" ( + "numF" INTEGER, + "nomF" VARCHAR(20), + "CatF" INTEGER, + "VilF" VARCHAR(15), + PRIMARY KEY("numF") +); +CREATE TABLE IF NOT EXISTS "Piece" ( + "numP" INTEGER, + "nomP" VARCHAR(20), + "clrP" VARCHER(20), + "PdsP" INTEGER, + PRIMARY KEY("numP") +); +CREATE TABLE IF NOT EXISTS "Livraison" ( + "numF" INTEGER, + "numP" INTEGER, + "Qte" INTEGER, + PRIMARY KEY("numF","numP"), + FOREIGN KEY("numF") REFERENCES "Fournisseur", + FOREIGN KEY("numP") REFERENCES "Piece" +); +INSERT INTO "Fournisseur" ("numF","nomF","CatF","VilF") VALUES (1,'Bricorama',2,'Melun'), + (2,'Castorama',2,'Melun'), + (3,'Bricorama',2,'Sénart'), + (4,'Amazon',3,NULL), + (32,'Thales',2,'Paris'); +INSERT INTO "Piece" ("numP","nomP","clrP","PdsP") VALUES (20,'Cle plate 24','Chrome',140), + (21,'Cle plate 18','Chrome',130), + (22,'Cle plate 16','Chrome',120), + (23,'Cle plate 14','Chrome',110), + (25,'engrenage','gris',310), + (34,'Boulon','Chrome',20); +INSERT INTO "Livraison" ("numF","numP","Qte") VALUES (32,25,40); +COMMIT;