Rajout TD2.sql

This commit is contained in:
Pierre Valarcher 2024-09-25 10:51:58 +02:00
parent 21d129ba49
commit b7ee8bb294

36
Code/TD2.sql Normal file
View File

@ -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;