Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Where in my BigQuery sql code do I fix the syntax error?

--I had no idea so many students are stuck in BigQuery, not a good sign for Google. I've wasted two days trying to Google a solution to my syntax error questions. The error appeared after I used the suggested sql code in the lesson. Any helpful suggestions are appreciated.

--Syntax error: Expected end of input but got identifier "dataset" at [8:16]

SELECT

stn,

date,

 --Use the IF function to replace 9999.9 values,

 

 which the dataset description explains is the default

 

 value when temperature is missing, with NULLS instead.

 

    IF(

 

        temp="9099.9",

 

        NULL,

 

        temp) AS temperature,

 

 --Use the IF function to replace 999.99 values, which

 

 the dataset description explains is the default value

 

 when wind speed is missing, with NULLS instead.

 

     IF(

 

         wdsp="999.9"

 

         NULL,

 

         CAST(wdsp AS Float64)) AS wind_speed,

 

 --Use the IF function to replace 99.99 values, which

 

 the dataset description explains is the default value

 

 when precipitation is missing, with NULLS instead.

 

     IF(

 

         prcp="99.99",

 

         0,

 

        prcp) AS precipitation

 

 FROM

 

   `bigquery-public-data.noaa_gsod.gsod2020`

 

 WHERE

 

   stn="725030" --La Guardia

 

   OR stn="744860" --JFK

 

 ORDER BY

 

   date DESC,

 

   stn ASC

 

1 3 34.3K
3 REPLIES 3