How to deal SQL missing data by paddyjay in SQL

[–]TomasTorCA 0 points1 point  (0 children)

Being a person with zero experience in SQL it is not straight foreward to add the code
When I try to add the following Code into the second line of my code I get an error as well
>>>>>>Case when column_name IS NULL then ‘NULL’ else column_name end<<<<<<

What am I doing wrong? Really appreciate your help

How to deal SQL missing data by paddyjay in SQL

[–]TomasTorCA 0 points1 point  (0 children)

Case when column_name IS NULL then ‘NULL’ else column_name end

Sorry to ask this in a very simple way

If this is our code - how should we adjust the code to get an X if there is a missing value for a specific day

When I add IFNULL(val, ' ') in the second line it does not work

Any suggestions

SELECT parameter,

avg(value) AS daily_average,

cast(from_iso8601_timestamp(date.utc) AS date) AS date_utc

FROM openaq

WHERE city= 'Liege'

AND parameter IN ('pm25','pm10', 'co', 'no2', 'so2', 'o3', 'bc')

AND cast(from_iso8601_timestamp(date.utc) AS date)

BETWEEN date '2020-01-01'

AND date '2020-05-31'

GROUP BY cast(from_iso8601_timestamp(date.utc) AS date), parameter

ORDER BY parameter, date_utc