To use aggregate functions meaningfully on the charge column, it would need to be expressed as a cumulative value that matches the granularity of the valid time column. For example, if the charge for each aircraft service job is expressed, in this case, as a charge per day, sequenced aggregations such as SUM and AVG can be applied with meaningful results.
For example, assume the data for the aircraft company had the charge for each type of service job expressed as a charge per day.
|123||Wing||20||4 Jan 2011 – 8 Jan 2011|
|123||Fuselage||10||5 Jan 2011 – 7 Jan 2011|
|123||Landing Gear||2||6 Jan 2011 – 9 Jan 2011|
The following sequenced aggregate query yields meaningful results.
SEQUENCED VALIDTIME SELECT id, SUM (ChargePerDay) TotalChargePerDay , AVG (ChargePerDay) AvgChargePerDay FROM aircraft_service GROUP BY 1 ORDER BY VALIDTIME;