From cfa1a6232d6ddba30301fbf720dc53f5e7142898 Mon Sep 17 00:00:00 2001 From: Albert Braimi Date: Tue, 28 Oct 2025 16:41:08 +0100 Subject: [PATCH] Ajout de toutes les requetes --- README.md | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/README.md b/README.md index 2365780..836d729 100644 --- a/README.md +++ b/README.md @@ -296,3 +296,137 @@ LEFT JOIN +---------------------------+-------------------+ 9854 rows in set (0.010 sec) ``` + +##### Requête 7 +```sql +SELECT + C.nom, + COUNT(A.avion_id) AS nombre_avions +FROM + t_compagnie AS C +LEFT JOIN + t_avion AS A ON C.compagnie_id = A.compagnie_fk +GROUP BY + C.compagnie_id, C.nom +ORDER BY + nombre_avions DESC; +``` + +``` ++----------------------+---------------+ +| nom | nombre_avions | ++----------------------+---------------+ +| Australia Airlines | 466 | +| Croatia Airlines | 450 | +| Czech Airlines | 448 | +| Guadeloupe Airlines | 443 | +| Laos Airlines | 439 | +| Peru Airlines | 438 | +| Greece Airlines | 436 | +| Ghana Airlines | 430 | +| Isla De Pascua Airli | 400 | +| Gibraltar Airlines | 0 | +| ... | ... | ++----------------------+---------------+ +110 rows in set (0.023 sec) +``` + +##### Requête 8 +```sql +SELECT compagnie_fk, COUNT(*) AS nombre_vols +FROM t_vol +GROUP BY compagnie_fk +HAVING nombre_vols >= 1500 +ORDER BY nombre_vols DESC +LIMIT 5; +``` + +``` ++--------------+-------------+ +| compagnie_fk | nombre_vols | ++--------------+-------------+ +| 76 | 4769 | +| 12 | 3779 | +| 111 | 3772 | +| 105 | 3748 | +| 80 | 3727 | ++--------------+-------------+ +5 rows in set (0.089 sec) +``` + +##### Requête 9 +```sql +SELECT + C.nom AS nom_compagnie, + A.nom AS nom_aeroport_depart, + COUNT(*) AS nombre_vols +FROM + t_vol AS V +JOIN + t_compagnie AS C ON V.compagnie_fk = C.compagnie_id +JOIN + t_aeroport AS A ON V.aeroport_depart_fk = A.aeroport_id +GROUP BY + C.nom, A.nom +ORDER BY + nom_compagnie ASC, + nombre_vols DESC; +``` + +``` ++----------------------+---------------------+-------------+ +| nom_compagnie | nom_aeroport_depart | nombre_vols | ++----------------------+---------------------+-------------+ +| Afghanistan Airlines | TOMBOUCTOU | 84 | +| Afghanistan Airlines | MESSLA | 62 | +| Afghanistan Airlines | ASHEVILLE REGL | 55 | +| Afghanistan Airlines | NEW MINAMIDAITO | 54 | +| Afghanistan Airlines | PLAGE BLANCHE | 51 | +| Afghanistan Airlines | FT BRIDGER | 51 | +| Afghanistan Airlines | VREDENDAL | 50 | +| Afghanistan Airlines | MC QUESTEN | 49 | +| Afghanistan Airlines | CASEMENT AB | 48 | +| Afghanistan Airlines | SHAWNEE MUN | 48 | +| ... | ... | ... | ++----------------------+---------------------+-------------+ +9555 rows in set (0.755 sec) +``` + +##### Requête 10 +```sql +SELECT + C.nom AS nom_compagnie, + TA.nom AS nom_type_avion, + SUM(A.capacite) AS capacite_totale +FROM + t_avion AS A +JOIN + t_compagnie AS C ON A.compagnie_fk = C.compagnie_id +JOIN + t_type_avion AS TA ON A.type_avion_fk = TA.type_avion_id +GROUP BY + C.nom, TA.nom +ORDER BY + capacite_totale DESC; +``` + +``` ++--------------------+------------------------+-----------------+ +| nom_compagnie | nom_type_avion | capacite_totale | ++--------------------+------------------------+-----------------+ +| Australia Airlines | Douglas DC-2 | 8372 | +| Australia Airlines | Junkers W 34 | 5796 | +| Australia Airlines | Piper PA-28 | 5796 | +| Australia Airlines | Antonow An-22 | 5796 | +| Croatia Airlines | Short S.23 | 5460 | +| Australia Airlines | Rolladen Schneider LS8 | 5152 | +| Australia Airlines | Boeing 757 | 5152 | +| Australia Airlines | Lockheed L-1011 | 5152 | +| Australia Airlines | Schempp-Hirth Discus | 5152 | +| Australia Airlines | Junkers Ju 52/3m | 5152 | +| ... | ... | ... | ++--------------------+------------------------+-----------------+ +900 rows in set (0.012 sec) +``` + +