diff --git a/README.md b/README.md index 5e6c6c9..2365780 100644 --- a/README.md +++ b/README.md @@ -141,10 +141,158 @@ Records: 5455883 Deleted: 0 Skipped: 0 Warnings: 0 ``` -# Requetes +## Requêtes -SELECT immatriculation, capacite +##### Requête 1 +```sql +SELECT * FROM t_avion -WHERE compagnie_fk = 60 -ORDER BY t_avion.capacite DESC +WHERE compagnie_fk = 60 +ORDER BY capacite DESC LIMIT 2; +``` + +``` ++----------+----------+--------------+---------------+ +| avion_id | capacite | compagnie_fk | type_avion_fk | ++----------+----------+--------------+---------------+ +| 11 | 380 | 60 | 89 | +| 20 | 380 | 60 | 89 | ++----------+----------+--------------+---------------+ +2 rows in set (0.006 sec) +``` + + +##### Requête 2 +```sql +SELECT * +FROM t_vol +ORDER BY heure_depart DESC +LIMIT 3; +``` + +``` ++--------+--------------+---------------+----------+--------------+---------------------+--------------------+---------------+ +| vol_id | heure_depart | heure_arrivee | avion_fk | compagnie_fk | aeroport_arrivee_fk | aeroport_depart_fk | numero_vol_fk | ++--------+--------------+---------------+----------+--------------+---------------------+--------------------+---------------+ +| 680 | 23:59:00 | 13:09:00 | 352 | 16 | 3913 | 5615 | CH2311 | +| 955 | 23:59:00 | 15:17:00 | 4024 | 22 | 2016 | 12744 | DA6839 | +| 4292 | 23:59:00 | 01:17:00 | 3630 | 99 | 1549 | 10840 | TU4730 | ++--------+--------------+---------------+----------+--------------+---------------------+--------------------+---------------+ +3 rows in set (0.118 sec) +``` + +##### Requête 3 +```sql +SELECT compagnie_fk, COUNT(*) AS nombre_de_vols +FROM t_vol +GROUP BY compagnie_fk +ORDER BY nombre_de_vols DESC; +``` + +``` ++--------------+----------------+ +| compagnie_fk | nombre_de_vols | ++--------------+----------------+ +| 76 | 4769 | +| 12 | 3779 | +| 111 | 3772 | +| 105 | 3748 | +| 80 | 3727 | +| ... | ... | ++--------------+----------------+ +110 rows in set (0.116 sec) +``` + +##### Requête 4 +```sql +SELECT + P.nom, + P.prenom, + P.numero_passeport, + A.nom AS nom_aeroport_depart +FROM + t_passager AS P +JOIN + t_reservation AS R ON P.passager_id = R.passager_fk +JOIN + t_vol AS V ON R.vol_fk = V.vol_id +JOIN + t_aeroport AS A ON V.aeroport_depart_fk = A.aeroport_id; +``` + +``` ++----------+------------+------------------+---------------------+ +| nom | prenom | numero_passeport | nom_aeroport_depart | ++----------+------------+------------------+---------------------+ +| Rod | Evans | P106826 | A.T.D. YILMA INTL | +| Michael | Hague | P107373 | A.T.D. YILMA INTL | +| Rita | Tushingham | P104848 | A.T.D. YILMA INTL | +| Michael | Anthony | P108677 | A.T.D. YILMA INTL | +| Carolina | Chiappetta | P128793 | A.T.D. YILMA INTL | +| Mike | Hollis | P119464 | A.T.D. YILMA INTL | +| Zack | Hopkins | P137755 | A.T.D. YILMA INTL | +| Eric | Bledsoe | P139017 | A.T.D. YILMA INTL | +| Darren | Clarke | P132289 | A.T.D. YILMA INTL | +| Daniela | Preisley | P137518 | A.T.D. YILMA INTL | +| ... | ... | ... | ... | ++----------+------------+------------------+---------------------+ +5455883 rows in set (16.492 sec) +``` + +##### Requête 5 +```sql +SELECT vol_fk, AVG(prix) AS prix_moyen +FROM t_reservation +GROUP BY vol_fk +ORDER BY prix_moyen ASC; +``` + +``` ++--------+------------+ +| vol_fk | prix_moyen | ++--------+------------+ +| 127444 | 162.421489 | +| 336974 | 162.713235 | +| 291125 | 165.013415 | +| 156280 | 170.002195 | +| 403524 | 172.109118 | +| 393692 | 173.468621 | +| 213748 | 174.344444 | +| 190835 | 175.164750 | +| 249577 | 176.198372 | +| 33249 | 176.622667 | +| ... | ... | ++--------+------------+ +42714 rows in set (1.633 sec) +``` + +##### Requête 6 +```sql +SELECT + A.nom AS nom_aeroport, + C.nom AS nom_compagnie +FROM + t_aeroport AS A +LEFT JOIN + t_compagnie AS C ON A.aeroport_id = C.aeroport_fk; +``` + +``` ++---------------------------+-------------------+ +| nom_aeroport | nom_compagnie | ++---------------------------+-------------------+ +| A CORUNA | Spain Airlines | +| A R S SPORT STRIP | NULL | +| A. BOUSSOUF AIN BOUCHEKIF | NULL | +| A.T.D. YILMA INTL | Ethiopia Airlines | +| A-306 | Korea Airlines | +| A-511 AAF | NULL | +| AALBORG | Denmark Airlines | +| AARHUS | NULL | +| AARS | NULL | +| AASIAAT | NULL | +| ... | ... | ++---------------------------+-------------------+ +9854 rows in set (0.010 sec) +```