Summer Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dates
Time
Timestamps
21. Timestamps – additional practice
Extract functions
Timezone conversion
Intervals
Current date and time
Review

Instruction

Excellent! Let's do another exercise for further practice.

Exercise

For each aircraft, show its id as aircraft_id and calculate the average distance (call it average) 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 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.