Ajout de toutes les requetes
This commit is contained in:
parent
6e52e402a9
commit
cfa1a6232d
134
README.md
134
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)
|
||||
```
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user