Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dealing with dates
Working with time
Date and time data types in PostgreSQL
22. Practice time!
Extracting dates and times
Timezone conversion
Format date and time
Current date and time data
Summary

Instruction

Very good! Let's do another exercise for practice.

Exercise

For each aircraft, show its ID number (as aircraft_id) and calculate the average distance covered on all its routes, and name it avg_distance. Only show data for aircraft that were launched before January 1, 2014, and took more than one flight.

Stuck? Here's a hint!

  • Use AVG(x) to find the average value of x.
  • Use HAVING COUNT(...) > ... after GROUP BY for the "more than one flight" condition.