ComenzarEmpieza gratis

Truncating dates

You've been asked to create an output of a date in descending order and the average daily humidity in Coffee County; however, the table is setup in 20 minute increments. While you could do this by CASTing the timestamp to a date, let's use one of the functions we just learned to make this faster.

Este ejercicio forma parte del curso

Introduction to Redshift

Ver curso

Instrucciones del ejercicio

  • Use a function on the date timestamp field to get just the date from the timestamp.
  • Calculate the average of the humidity by day,hourlyrelativehumidity, and order in reverse chronological order.
  • Group by the date, and order by the date descending.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

-- Select just the actual date from the date field
SELECT ___(___) as day,
       -- Calculate the average daily humidity from hourlyrelativehumidity
       ___(___)
  FROM public_intro_redshift.coffee_county_weather
 -- Group by the day
 GROUP BY ___
 -- Order by the day in reverse chronological order.
 ORDER BY day ___;
Editar y ejecutar código