Introduction
Dates
Time
Timestamps
21. Timestamps – additional practice
Extract functions
Timezone conversion
Intervals
Current date and time
Revision

Instruction

Jolly good! Let's do another exercise for further practice.

Exercise

For each aircraft, show its id as aircraft_id and calculate the average distance covered on all its routes. Only take into account those aircrafts which were launched before January 1, 2014 and took more than 1 flight.

Stuck? Here's a hint!

  1. Use avg(x) to find the average value of x.
  2. Remember about the proper date format and use apostrophes: 'YYYY-MM-DD'.
  3. You can use HAVING with COUNT(x) after GROUP BY to satisfy the condition for more than 1 flight.

Console

Code editor

Result

TableConsole