1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Redshift

Connected

Exercise

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.

Instructions

100 XP
  • 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.