From ef246389d9274f5938e0d9a8accc2180de18d285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SAEZ=20Th=C3=A9o?= <theo.saez@etu.univ-amu.fr> Date: Tue, 6 May 2025 19:20:49 +0200 Subject: [PATCH] Ajout de la VIEW NbPlacesLibresLiaisons -- FIN DU TP --- BusTP2-Q3.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/BusTP2-Q3.sql b/BusTP2-Q3.sql index 2a3ad75..43a48a1 100644 --- a/BusTP2-Q3.sql +++ b/BusTP2-Q3.sql @@ -45,7 +45,18 @@ GROUP BY l.NUMT, l.VILLED, l.VILLEA /* Test de la vue */ SELECT * FROM NbPlacesOccupéesLiaisons; +--- + +/* Vue NbPlacesLibresLiaisons */ +CREATE OR REPLACE VIEW NbPlacesLibresLiaisons AS +SELECT n.NUMT, n.VILLED, n.VILLEA, b.CAPACITÉB - n.PLACESOCCUPÉES AS PlacesLibres +FROM NbPlacesOccupéesLiaisons n +JOIN TRAJETS t ON t.NUMT = n.NUMT +JOIN BUS b ON b.NUMB = t.NUMB +; +/* Test de la vue */ +SELECT * FROM NbPlacesLibresLiaisons; COMMIT; \ No newline at end of file -- GitLab