Skip to content

Austin Bikeshare Stats Solution


SELECT
  count(*) as trips,
  min(start_time) as min_start_time,
  max(start_time) as max_start_time,
  avg(duration_minutes) as avg_duration_minutes
FROM `bigquery-public-data.austin_bikeshare.bikeshare_trips`

Explanation

  1. count(*) counts the number of rows in the table.
  2. min(start_time) as min_start_time aggregates the start_time field, measuring the min start_time and naming the result min_start_time.
  3. max(start_time) as max_start_time aggregates the start_time field, measuring the max start_time and naming the result max_start_time.
  4. avg(duration_minutes) as avg_duration_minutes aggregates the duration_minutes field, measuring the mean duration_minutes and naming the result avg_duration_minutes.
  5. FROM bigquery-public-data.austin_bikeshare.bikeshare_trips references the bikeshare_trips table in the austin_bikeshare dataset in the bigquery-public-data project.

See the problem