1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| insert into ChauffeurOccasionnel
values (1), (2)
;
select '' as ChauffeurOccasionnel, Matricule
from ChauffeurOccasionnel as a
join Chauffeur as b on a.EmployeId = b.EmployeId
join Employe as c on b.EmployeId = c.EmployeId
;
insert into Voiture (VoitureId, Immatriculation)
values
(1, 'immat01'), (2, 'immat02'), (3, 'immat03'), (4, 'immat04'), (5, 'immat05')
;
select '' as Voiture, * from Voiture ;
insert into VoitureSociete (VoitureId)
values (1), (2), (3)
;
select '' as VoitureSociete, * from VoitureSociete ;
insert into VoiturePersonnelle (VoitureId, EmployeId)
values (4, 1), (5, 2)
;
select '' as VoiturePersonnelle, * from VoiturePersonnelle ;
insert into MissionAchaufeurOccas(MissionId, VoitureId)
values
(1, 4)
;
select '' as MissionAchaufeurOccas, * from MissionAchaufeurOccas ;
insert into MissionAchauffeurSte (MissionId, VoitureId, EmployeId)
values
(2, 1, 5) -- l'employé 5 est bien chauffeur de société
--(2, 1, 3) -- l'employé 3 n'est pas chauffeur de société
;
select '' as MissionAchauffeurSte
, b.MissionDesignation as Mission
, d.Matricule, d.EmployeNom, f.FonctionDesignation as Fonction
, a.VoitureId
, c.MoyenDeplacementDesignation as MoyenDeplacement
from MissionAchauffeurSte as a
join Mission as b on a.MissionId = b.MissionId
join MoyenDeplacement as c on b.MoyenDeplacementId = c.MoyenDeplacementId
join Employe as d on a.EmployeId = d.EmployeId
join EmployeFonction as e on d.EmployeId = e.EmployeId
join Fonction as f on e.FonctionId = f.FonctionId
;
/* tentative infraction
insert into MissionAchaufeurOccas(MissionId, VoitureId)
values
(2, 4)
;
*/
select '' as MissionAchaufeurOccas, * from MissionAchaufeurOccas ;
--/*
--SELECT a.EmployeId, a.MissionId --,-- c.MoyenDeplacementDesignation
SELECT a.EmployeId, a.MissionId , c.MoyenDeplacementDesignation
From MissionAchauffeurSte as a
join Mission as b on a.MissionId = b.MissionId
join MoyenDeplacement as c on b.MoyenDeplacementId = c.MoyenDeplacementId
WHERE a.MissionId = 1
--*/ |
Partager