SQL Tutorial

Aggregating Techniques

📚 Schema reference · PNW flights 5 tables
airlines
  • carrier
  • name
airports
  • faa
  • name
  • lat
  • lon
  • alt
  • tz
  • dst
  • tzone
flights
  • year
  • month
  • day
  • dep_time
  • sched_dep_time
  • dep_delay
  • arr_time
  • sched_arr_time
  • arr_delay
  • carrier
  • flight
  • tailnum
  • origin
  • dest
  • air_time
  • distance
  • hour
  • minute
  • time_hour
planes
  • tailnum
  • year
  • type
  • manufacturer
  • model
  • engines
  • seats
  • speed
  • engine
weather
  • origin
  • year
  • month
  • day
  • hour
  • temp
  • dewp
  • humid
  • wind_dir
  • wind_speed
  • wind_gust
  • precip
  • pressure
  • visib
  • time_hour

Numerical summaries

  1. Calculate the average temperature from the weather table as avg_temperature
  1. Find the maximum arrival time for flights destined to ORD as max_arr_time

Categorical summaries

  1. Find the first destination alphabetically for flights from SEA as first_sea_dest

Rounding summaries

  1. Round wind gust values in the weather table to 0 decimal places as rounded_wind_gust