1
resposta

Não consigo obter resultados para selects de FROM `bigquery-public-data.ghcn_d.ghcnd_2016`

Fiz como pedido no curso e não consigo obter resultados. Alguém pode me ajudar? Minhas consultas:

SELECT date, (MAX(prcp) > 5) AS rainy FROM (
SELECT date, IF(element = 'PRCP', value/10, NULL) AS prcp
FROM `bigquery-public-data.ghcn_d.ghcnd_2016`
WHERE id = 'USW00094728')
GROUP BY date; 

e

WITH bicycle_rentals AS (
SELECT COUNT(starttime) AS num_trips,
EXTRACT(date FROM starttime) AS trip_date
FROM `bigquery-public-data`.new_york_citibike.citibike_trips citibike_trips
GROUP BY trip_date),
rainy_days AS (
SELECT date, (MAX(prcp) > 5) AS rainy FROM (
SELECT date, IF(element = 'PRCP', value/10, NULL) AS prcp
FROM `bigquery-public-data.ghcn_d.ghcnd_2016`
WHERE id = 'USW00094728')
GROUP BY date)
SELECT bicycle_rentals.trip_date, bicycle_rentals.num_trips, rainy_days.rainy
FROM bicycle_rentals 
INNER JOIN rainy_days
ON bicycle_rentals.trip_date = rainy_days.date;
1 resposta

Oi, Raphaela, tudo bem?

Eu testei suas consultas e funcionaram perfeitamente aqui.

veja:

WITH 
bicycle_rentals AS ( --primeiro with
SELECT COUNT(starttime) AS num_trips,
EXTRACT(date FROM starttime) AS trip_date
FROM `bigquery-public-data`.new_york_citibike.citibike_trips citibike_trips
GROUP BY trip_date),

rainy_days AS ( --segundo with
SELECT date, (MAX(prcp) > 5) AS rainy FROM (
SELECT date, IF(element = 'PRCP', value/10, NULL) AS prcp
FROM `bigquery-public-data`.ghcn_d.ghcnd_2016
WHERE id = 'USW00094728')
GROUP BY date)

SELECT bicycle_rentals.trip_date, bicycle_rentals.num_trips, rainy_days.rainy
FROM bicycle_rentals 
INNER JOIN rainy_days
ON bicycle_rentals.trip_date = rainy_days.date;