THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
> SELECT * FROM Bid;
--------------------------
| bidtime | price | item |
--------------------------
| 8:07 | $2 | A |
| 8:11 | $3 | B |
| 8:05 | $4 | C |
| 8:09 | $5 | D |
| 8:13 | $1 | E |
| 8:17 | $6 | F |
--------------------------
> SELECT * FROM TABLE(
TUMBLE(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '10' MINUTES));
-- or with the named params
-- note: the DATA param must be the first
> SELECT * FROM TABLE(
TUMBLE(
DATA => TABLE Bid,
TIMECOL => DESCRIPTOR(bidtime),
SIZE => INTERVAL '10' MINUTES));
------------------------------------------------------
| bidtime | price | item | window_start | window_end |
------------------------------------------------------
| 8:07 | $2 | A | 8:00 | 8:10 |
| 8:11 | $3 | B | 8:10 | 8:20 |
| 8:05 | $4 | C | 8:00 | 8:10 |
| 8:09 | $5 | D | 8:00 | 8:10 |
| 8:13 | $1 | E | 8:10 | 8:20 |
| 8:17 | $6 | F | 8:10 | 8:20 |
------------------------------------------------------
> SELECT window_start, window_end, SUM(price)
FROM TABLE(
TUMBLE(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '10' MINUTES))
GROUP BY window_start, window_end;
-------------------------------------
| window_start | window_end | price |
-------------------------------------
| 8:00 | 8:10 | $11 |
| 8:10 | 8:20 | $10 |
------------------------------------- |
...