I have a data source which for all intents and purposes is based on web analytics, the table cardinality is 1 row = each minute of each hour of each date in a select date range. Sometimes this data does not return a record for every minute of the day (where no activity was registered in the data source during that minute). An example is as follows, with the missing minutes being 17:26 and 17:28:
+------------+------+--------+--------+---------+
| Date | Hour | Minute | Visits | Bounces |
+------------+------+--------+--------+---------+
| 2015-09-07 | 17 | 24 | 499 | 58 |
| 2015-09-07 | 17 | 25 | 32 | 4 |
| 2015-09-07 | 17 | 27 | 12 | 1 |
| 2015-09-07 | 17 | 29 | 6 | 0 |
+------------+------+--------+--------+---------+
For our purposes, we need each day to equate to it's full range of minutes, and these records where no activity was registered should not be absent from the database, but rather be entered as records with the measure columns null, which would output the following:
+------------+------+--------+--------+---------+
| Date | Hour | Minute | Visits | Bounces |
+------------+------+--------+--------+---------+
| 2015-09-07 | 17 | 24 | 499 | 58 |
| 2015-09-07 | 17 | 25 | 32 | 4 |
| 2015-09-07 | 17 | 26 | 0 | 0 |
| 2015-09-07 | 17 | 27 | 12 | 1 |
| 2015-09-07 | 17 | 28 | 0 | 0 |
| 2015-09-07 | 17 | 29 | 6 | 0 |
+------------+------+--------+--------+---------+
I've thought about utilizing the set functions to include minutes where they do not exist, but this would return the missing record as literally just the minute, no date or hour data would be carried into the record so I've got to admit I'm a little stumped!