Professional Documents
Culture Documents
/*
When it snows in excess of six inches per day, my company experiences delivery delays. How many of
my deliveries were impacted during the third week of January for the previous year?
*/
WITH timestamps AS
SELECT
DATE_TRUNC(year,DATEADD(year,-1,CURRENT_DATE())) AS ref_timestamp,
LAST_DAY(DATEADD(week,2 + CAST(WEEKISO(ref_timestamp) != 1 AS
INTEGER),ref_timestamp),week) AS end_week,
FROM
SELECT
FROM
SELECT
country,
postal_code,
date_valid_std,
tot_snowfall_in
FROM
standard_tile.history_day
timestamps
WHERE
country='US' AND
postal_code,date_valid_std
/*
I am hosting an outdoor event in seven days. How can I utilize your forecast data to determine if my
event will be impacted by rain?
*/
/*
Our company sells 70% more product when the temperature is in excess of 80 degrees and I am
trying to create a product sales forecast for this upcoming July. How can we use your climatology
data to quickly ascertain how many days “normally” exceed 80 degrees during the month of July?
*/
// Can my restaurant use weather to determine the amount of footfall traffic that we will have in the
next week?
/*
Our restaurant has a significant amount of outdoor dining space. We need to determine staffing and
demand based on the forecasted weather for next week.
*/
SELECT
postal_code,
country,
date_valid_std,
avg_temperature_air_2m_f,
avg_humidity_relative_2m_pct,
avg_wind_speed_10m_mph,
tot_precipitation_in,
tot_snowfall_in,
avg_cloud_cover_tot_pct,
probability_of_precipitation_pct,
probability_of_snow_pct
FROM
SELECT
postal_code,
country,
date_valid_std,
avg_temperature_air_2m_f,
avg_humidity_relative_2m_pct,
avg_wind_speed_10m_mph,
tot_precipitation_in,
tot_snowfall_in,
avg_cloud_cover_tot_pct,
probability_of_precipitation_pct,
probability_of_snow_pct,
DATEADD(DAY,1,CURRENT_DATE()) AS skip_date,
FROM
standard_tile.forecast_day
WHERE
ORDER BY
date_valid_std
;