CommencerCommencer gratuitement

Find future dates

When doing some research, you discover that Coffee County hit a low humidity of 10 on '2023-01-15 15:35:00'. The field staff would like a query with the date and hourlystationpressure listed, 30 days prior, 30 days later, and 90 days later.

Cet exercice fait partie du cours

Introduction to Redshift

Afficher le cours

Instructions

  • Select the date and the hourlystationpressure for '2023-01-15 15:35:00', 30 days prior, 30 days later, and 90 days later.
  • Build a proper IN clause list using DATEADD functions to get 30 days prior, 30 days later and 90 days later.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

SELECT date, 
       hourlystationpressure
  FROM public_intro_redshift.coffee_county_weather
 WHERE ___ IN (
           '2023-01-15 15:35:00', 
           -- 30 days prior
           ___(___, ___, '2023-01-15 15:35:00'), 
           -- 30 days later
           ___(___, ___, '2023-01-15 15:35:00'), 
           -- 90 days later
           ___(___, ___, '2023-01-15 15:35:00')
       )
 ORDER BY date;
Modifier et exécuter le code