62 lines
1.2 KiB
SQL
62 lines
1.2 KiB
SQL
-- 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)
|
|
)
|