Option 1: Remove Missing Values - Advanced SQL Engine - Teradata Database

Time Series Tables and Operations

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
zzg1600277315070.ditamap
dita:ditavalPath
zzg1600277315070.ditaval
dita:id
B035-1208
lifecycle
previous
Product Category
Teradata Vantageā„¢

You can use the DELETE statement to remove all rows with a missing value. The example shows this for the TEMPERATURE column in Table and Data Definition for Time Series Aggregates Examples.

DELETE FROM OCEAN_BUOYS WHERE TEMPERATURE IS NULL;

After removing the NULL rows, run your query; for example, run a query that performs an AVERAGE:

SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, AVG(TEMPERATURE), COUNT(*)
FROM OCEAN_BUOYS
WHERE TD_TIMECODE BETWEEN TIMESTAMP '2014-01-06 08:00:00' AND TIMESTAMP '2014-01-06 10:30:00'
AND BUOYID=0
GROUP BY TIME (MINUTES(10) AND BUOYID)
ORDER BY 2,3;

Result: Note the result in the first row.

TIMECODE_RANGE GROUP BY TIME(MINUTES(10)) BUOYID Average(TEMPERATURE) COUNT(*)
('2014-01-06 08:00:00.000000+00:00', '2014-01-06 08:10:00.000000+00:00') 1 0 54 2
('2014-01-06 08:10:00.000000+00:00', '2014-01-06 08:20:00.000000+00:00') 2 0 55 2