You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECTCOUNT(*) AS num_flights
FROM flight f
JOIN airport a_src ONf.from=a_src.airport_idJOIN airport a_dest ONf.to=a_dest.airport_idWHEREa_src.name='BORG EL ARAB INTL'ANDa_dest.name='LABUAN';
Query 2
SELECT seat, AVG(price) AS AveragePricePerSeat
FROM booking
WHERE flight_id =3863AND seat IS NOT NULLGROUP BY seat;
seat
AveragePricePerSeat
10B
116.88
10C
291.85
10D
340.28
10E
325.60
11C
239.53
11E
314.09
12A
115.98
12B
400.12
13H
366.26
14A
130.23
14B
9.42
14C
344.20
14D
259.62
14E
291.60
15B
33.72
15E
204.19
16A
26.42
16B
9.42
16G
388.23
16H
306.92
17C
62.05
17F
181.57
17H
324.69
18A
451.65
18B
75.91
18D
428.49
18G
274.71
19A
319.06
19B
17.47
19D
334.33
19H
500.63
1B
288.89
1D
164.70
1E
396.21
1G
91.86
20A
216.94
20D
10.46
20G
413.03
20H
21.15
21A
131.94
21F
6.23
21G
411.34
22C
264.82
22F
221.48
23E
170.03
24D
445.85
24F
275.88
24G
198.32
25E
323.15
25F
173.10
2D
479.65
2E
345.30
2F
321.60
3C
104.90
3G
31.96
3H
233.66
4B
166.44
5A
437.98
5D
197.80
5G
229.01
6B
108.49
6C
109.55
6E
466.79
6F
462.32
7A
83.04
7C
435.00
7E
211.65
7G
423.36
7H
346.47
8A
346.27
8B
328.66
8F
251.86
8G
184.47
8H
276.07
9C
329.42
9E
461.97
9H
66.52
77 rows in set (0.00 sec)
Query 3
SELECTCOUNT(DISTINCT t.identifier) AS airline_type_number
FROM booking b
JOIN flight f ONb.flight_id=f.flight_idJOIN airplane a ONf.airplane_id=a.airplane_idJOIN airplane_type t ONa.type_id=t.type_idWHEREb.passenger_id=16678;
SELECT DISTINCTt.identifierAS airline_type
FROM booking b
JOIN flight f ONb.flight_id=f.flight_idJOIN airplane a ONf.airplane_id=a.airplane_idJOIN airplane_type t ONa.type_id=t.type_idWHEREb.passenger_id=16678;
Query 4
Assuming there has to be flight on that day
SELECTCOUNT(DISTINCT DATE(f.departure)) AS total_dates
FROM flight f
JOIN weatherdata w ONDATE(f.departure) =w.log_dateWHEREw.humidity>=98ANDw.airpressure>1015;
SELECT DISTINCTDATE(f.departure) AS flight_date
FROM flight f
JOIN weatherdata w ONDATE(f.departure) =w.log_dateWHEREw.humidity>=98ANDw.airpressure>1015;
Assuming it is not compulsory to have flight on that day
SELECTCOUNT(DISTINCT DATE(log_date)) AS total_dates
FROM weatherdata
WHERE humidity >=98AND airpressure >1015;
Query 5
SELECTa.airlinename, SUM(b.price) AS total_revenue
FROM flight f
JOIN booking b ONf.flight_id=b.flight_idJOIN airline a ONf.airline_id=a.airline_idGROUP BYf.airline_id, a.airlinenameORDER BY total_revenue DESC;