transport
This commit is contained in:
42
transport/data.sql
Normal file
42
transport/data.sql
Normal file
@@ -0,0 +1,42 @@
|
||||
PRAGMA foreign_keys = ON;
|
||||
|
||||
insert into societe values (1, 'UPS');
|
||||
|
||||
insert into entrepot (ville) values
|
||||
('Saint Dié'),
|
||||
('Paris'),
|
||||
('Lyon'),
|
||||
('Marseille');
|
||||
|
||||
|
||||
insert into permis (categorie, poids_maximum)
|
||||
values
|
||||
('A', 0.75),
|
||||
('B', 3.5),
|
||||
('C', 35),
|
||||
('D', 44);
|
||||
|
||||
|
||||
insert into chauffeur (id, nom) values
|
||||
(1, 'Albert'),
|
||||
(2, 'Samia'),
|
||||
(3, 'Samy');
|
||||
|
||||
|
||||
insert into examen (numero, date,
|
||||
permis, chauffeur_id) values
|
||||
(11156, '2020-04-20', 'A', 1),
|
||||
(98212, '2023-06-13', 'B', 1),
|
||||
(66874, '2022-10-21', 'C', 2);
|
||||
|
||||
|
||||
insert into camion (immatriculation, marque, capacite) values
|
||||
('FR-234-PO', 'Volvo', 44),
|
||||
('EU-324-FE', 'Renault', 35),
|
||||
('DF-463-VD', 'Mercedes', 44),
|
||||
('CD-333-LW', 'Volvo', 35),
|
||||
('BG-468-VS', 'Iveco', 20);
|
||||
|
||||
|
||||
insert into transport values
|
||||
(1, '2025-09-20', 'FR-234-PO', 2, 1, 3);
|
||||
61
transport/initdb.sql
Normal file
61
transport/initdb.sql
Normal file
@@ -0,0 +1,61 @@
|
||||
-- La table société
|
||||
create table societe (
|
||||
id integer primary key,
|
||||
nom text
|
||||
);
|
||||
|
||||
-- La table chauffeur
|
||||
create table chauffeur (
|
||||
id integer primary key,
|
||||
nom text
|
||||
);
|
||||
|
||||
|
||||
-- La table entrepot
|
||||
create table entrepot (
|
||||
id integer primary key,
|
||||
ville text
|
||||
);
|
||||
|
||||
-- La table camion
|
||||
create table camion (
|
||||
immatriculation text primary key,
|
||||
marque text,
|
||||
capacite numeric,
|
||||
permis text,
|
||||
foreign key (permis) references permis(categorie)
|
||||
);
|
||||
|
||||
-- La table permis
|
||||
create table permis (
|
||||
categorie text primary key,
|
||||
poids_maximum numeric
|
||||
);
|
||||
|
||||
create table examen (
|
||||
numero integer primary key,
|
||||
date text,
|
||||
permis text,
|
||||
chauffeur_id integer,
|
||||
foreign key (chauffeur_id)
|
||||
references chauffeur(id),
|
||||
foreign key (permis)
|
||||
references permis(categorie)
|
||||
);
|
||||
|
||||
create table transport (
|
||||
id integer primary key,
|
||||
jour text,
|
||||
camion_immatriculation text,
|
||||
chauffeur_id integer,
|
||||
entrepot_depart_id integer,
|
||||
entrepot_arrivee_id integer,
|
||||
foreign key (chauffeur_id)
|
||||
references chauffeur(id),
|
||||
foreign key (camion_immatriculation)
|
||||
references camion(immatriculation),
|
||||
foreign key (entrepot_depart_id)
|
||||
references entrepot(id),
|
||||
foreign key (entrepot_arrivee_id)
|
||||
references entrepot(id)
|
||||
)
|
||||
Reference in New Issue
Block a user