diff --git a/docs/UsingSamples.md b/docs/UsingSamples.md index 7e0fb3527..634b28397 100644 --- a/docs/UsingSamples.md +++ b/docs/UsingSamples.md @@ -115,16 +115,16 @@ ORDER BY time DESC LIMIT 10; time | device_id | battery_temperature -----------------------+------------+--------------------- -2016-11-15 23:39:30-05 | demo000000 | 101 -2016-11-15 23:39:30-05 | demo000016 | 97 -2016-11-15 23:39:30-05 | demo000019 | 96.3 -2016-11-15 23:39:30-05 | demo000045 | 95.9 -2016-11-15 23:39:30-05 | demo000048 | 97.1 -2016-11-15 23:39:30-05 | demo000049 | 101.7 -2016-11-15 23:39:30-05 | demo000070 | 95.9 -2016-11-15 23:39:30-05 | demo000074 | 95.8 -2016-11-15 23:39:30-05 | demo000089 | 100.5 -2016-11-15 23:39:30-05 | demo000094 | 100.6 +2016-11-15 23:39:30-05 | demo004866 | 101.1 +2016-11-15 23:39:30-05 | demo004848 | 96 +2016-11-15 23:39:30-05 | demo004836 | 97.2 +2016-11-15 23:39:30-05 | demo004827 | 99.5 +2016-11-15 23:39:30-05 | demo004792 | 101.7 +2016-11-15 23:39:30-05 | demo004761 | 95.7 +2016-11-15 23:39:30-05 | demo004740 | 100.2 +2016-11-15 23:39:30-05 | demo004729 | 96.1 +2016-11-15 23:39:30-05 | demo004723 | 95.4 +2016-11-15 23:39:30-05 | demo004711 | 98.8 (10 rows) ``` @@ -140,14 +140,15 @@ ORDER BY cpu_avg_1min DESC, time DESC LIMIT 5; time | device_id | cpu_avg_1min | battery_level | battery_status | model -----------------------+------------+--------------+---------------+----------------+--------- -2016-11-15 22:51:00-05 | demo004320 | 98.99 | 32 | discharging | pinto -2016-11-15 21:16:30-05 | demo001647 | 98.99 | 30 | discharging | pinto -2016-11-15 19:13:00-05 | demo003758 | 98.99 | 30 | discharging | focus -2016-11-15 17:09:00-05 | demo004924 | 98.99 | 15 | discharging | mustang -2016-11-15 12:35:00-05 | demo002196 | 98.99 | 27 | discharging | pinto +2016-11-15 21:26:00-05 | demo000559 | 98.99 | 32 | discharging | mustang +2016-11-15 20:31:00-05 | demo000312 | 98.99 | 29 | discharging | pinto +2016-11-15 18:00:00-05 | demo002979 | 98.99 | 26 | discharging | pinto +2016-11-15 17:40:00-05 | demo003978 | 98.99 | 25 | discharging | pinto +2016-11-15 13:55:30-05 | demo004548 | 98.99 | 12 | discharging | pinto (5 rows) ``` +**Minimum and maximum battery levels per hour for the first 12 hours** ```sql SELECT date_trunc('hour', time) "hour", min(battery_level) min_battery_level, @@ -160,9 +161,9 @@ WHERE r.device_id IN ( hour | min_battery_level | max_battery_level -----------------------+-------------------+------------------- -2016-11-15 07:00:00-05 | 19 | 100 -2016-11-15 08:00:00-05 | 10 | 100 -2016-11-15 09:00:00-05 | 6 | 100 +2016-11-15 07:00:00-05 | 20 | 99 +2016-11-15 08:00:00-05 | 12 | 98 +2016-11-15 09:00:00-05 | 8 | 97 2016-11-15 10:00:00-05 | 6 | 100 2016-11-15 11:00:00-05 | 6 | 100 2016-11-15 12:00:00-05 | 6 | 100 @@ -215,18 +216,18 @@ _Note: Uses dataset_ `weather_med` ```sql SELECT * FROM conditions c ORDER BY time DESC LIMIT 10; -time | device_id | temperature | humidity ------------------------+--------------------+--------------------+-------------------- -2016-12-06 02:58:00-05 | weather-pro-000000 | 33.899999999999885 | 52.799999999999955 -2016-12-06 02:58:00-05 | weather-pro-000001 | 61.50000000000002 | 48.400000000000006 -2016-12-06 02:58:00-05 | weather-pro-000002 | 34.599999999999895 | 49.399999999999906 -2016-12-06 02:58:00-05 | weather-pro-000003 | 82.80000000000041 | 82.30000000000061 -2016-12-06 02:58:00-05 | weather-pro-000004 | 85.00000000000034 | 76.00000000000013 -2016-12-06 02:58:00-05 | weather-pro-000005 | 60.2 | 48.29999999999989 -2016-12-06 02:58:00-05 | weather-pro-000006 | 64 | 52.899999999999956 -2016-12-06 02:58:00-05 | weather-pro-000007 | 83.10000000000039 | 83.00000000000057 -2016-12-06 02:58:00-05 | weather-pro-000008 | 85.00000000000034 | 95.89999999999998 -2016-12-06 02:58:00-05 | weather-pro-000009 | 83.30000000000044 | 92.19999999999995 +time | device_id | temperature | humidity +-----------------------+--------------------+-------------------+------------------- +2016-12-06 02:58:00-05 | weather-pro-000999 | 35.49999999999991 | 50.60000000000004 +2016-12-06 02:58:00-05 | weather-pro-000998 | 34.7999999999999 | 48.70000000000001 +2016-12-06 02:58:00-05 | weather-pro-000997 | 84.90000000000035 | 86.30000000000001 +2016-12-06 02:58:00-05 | weather-pro-000996 | 83.40000000000038 | 83.40000000000055 +2016-12-06 02:58:00-05 | weather-pro-000995 | 83.30000000000038 | 82.4000000000006 +2016-12-06 02:58:00-05 | weather-pro-000994 | 83.9000000000004 | 70.70000000000024 +2016-12-06 02:58:00-05 | weather-pro-000993 | 35.79999999999991 | 51.30000000000005 +2016-12-06 02:58:00-05 | weather-pro-000992 | 81.90000000000046 | 82.4000000000006 +2016-12-06 02:58:00-05 | weather-pro-000991 | 62.1 | 48.2 +2016-12-06 02:58:00-05 | weather-pro-000990 | 83.60000000000042 | 76.70000000000014 (10 rows) ``` **Last 10 readings from 'outside' locations** @@ -240,16 +241,16 @@ ORDER BY time DESC LIMIT 10; time | device_id | location | temperature | humidity -----------------------+--------------------+---------------+-------------+---------- -2016-12-06 02:58:00-05 | weather-pro-000000 | arctic-000000 | 33.89 | 52.79 -2016-12-06 02:58:00-05 | weather-pro-000002 | arctic-000001 | 34.59 | 49.39 -2016-12-06 02:58:00-05 | weather-pro-000003 | field-000000 | 82.80 | 82.30 -2016-12-06 02:58:00-05 | weather-pro-000004 | swamp-000000 | 85.00 | 76.00 -2016-12-06 02:58:00-05 | weather-pro-000007 | field-000001 | 83.10 | 83.00 -2016-12-06 02:58:00-05 | weather-pro-000008 | swamp-000001 | 85.00 | 95.89 -2016-12-06 02:58:00-05 | weather-pro-000009 | swamp-000002 | 83.30 | 92.19 -2016-12-06 02:58:00-05 | weather-pro-000011 | swamp-000003 | 85.20 | 82.79 -2016-12-06 02:58:00-05 | weather-pro-000013 | arctic-000002 | 35.49 | 50.69 -2016-12-06 02:58:00-05 | weather-pro-000018 | swamp-000004 | 83.40 | 60.60 +2016-12-06 02:58:00-05 | weather-pro-000999 | arctic-000204 | 35.49 | 50.60 +2016-12-06 02:58:00-05 | weather-pro-000998 | arctic-000203 | 34.79 | 48.70 +2016-12-06 02:58:00-05 | weather-pro-000997 | swamp-000213 | 84.90 | 86.30 +2016-12-06 02:58:00-05 | weather-pro-000996 | field-000199 | 83.40 | 83.40 +2016-12-06 02:58:00-05 | weather-pro-000995 | field-000198 | 83.30 | 82.40 +2016-12-06 02:58:00-05 | weather-pro-000994 | swamp-000212 | 83.90 | 70.70 +2016-12-06 02:58:00-05 | weather-pro-000993 | arctic-000202 | 35.79 | 51.30 +2016-12-06 02:58:00-05 | weather-pro-000992 | field-000197 | 81.90 | 82.40 +2016-12-06 02:58:00-05 | weather-pro-000990 | swamp-000211 | 83.60 | 76.70 +2016-12-06 02:58:00-05 | weather-pro-000989 | field-000196 | 83.30 | 81.70 (10 rows) ``` @@ -267,29 +268,29 @@ WHERE c.device_id IN ( hour | avg_temp | min_temp | max_temp -----------------------+----------+----------+---------- -2016-11-15 07:00:00-05 | 73.24 | 68.00 | 78.89 -2016-11-15 08:00:00-05 | 74.25 | 69.09 | 80.09 -2016-11-15 09:00:00-05 | 75.24 | 69.59 | 81.09 -2016-11-15 10:00:00-05 | 76.25 | 70.69 | 82.39 -2016-11-15 11:00:00-05 | 77.26 | 71.29 | 83.59 -2016-11-15 12:00:00-05 | 78.26 | 72.39 | 84.79 -2016-11-15 13:00:00-05 | 79.24 | 73.19 | 85.79 -2016-11-15 14:00:00-05 | 80.22 | 73.69 | 86.79 -2016-11-15 15:00:00-05 | 81.22 | 74.49 | 87.59 -2016-11-15 16:00:00-05 | 82.24 | 75.29 | 88.59 -2016-11-15 17:00:00-05 | 83.22 | 76.59 | 89.39 -2016-11-15 18:00:00-05 | 84.23 | 77.59 | 90.00 -2016-11-15 19:00:00-05 | 85.22 | 78.39 | 90.00 -2016-11-15 20:00:00-05 | 85.16 | 78.29 | 90.00 -2016-11-15 21:00:00-05 | 84.16 | 77.49 | 89.59 -2016-11-15 22:00:00-05 | 83.16 | 76.19 | 88.59 -2016-11-15 23:00:00-05 | 82.15 | 75.09 | 87.70 -2016-11-16 00:00:00-05 | 81.15 | 74.09 | 86.70 -2016-11-16 01:00:00-05 | 80.15 | 72.99 | 85.90 -2016-11-16 02:00:00-05 | 79.14 | 71.89 | 84.80 -2016-11-16 03:00:00-05 | 78.13 | 70.69 | 83.69 -2016-11-16 04:00:00-05 | 77.15 | 69.39 | 82.80 -2016-11-16 05:00:00-05 | 77.16 | 69.39 | 83.60 -2016-11-16 06:00:00-05 | 78.13 | 70.59 | 84.90 +2016-11-15 07:00:00-05 | 73.59 | 68.10 | 79.09 +2016-11-15 08:00:00-05 | 74.59 | 68.89 | 80.19 +2016-11-15 09:00:00-05 | 75.60 | 69.79 | 81.69 +2016-11-15 10:00:00-05 | 76.59 | 70.49 | 82.79 +2016-11-15 11:00:00-05 | 77.59 | 71.69 | 84.19 +2016-11-15 12:00:00-05 | 78.59 | 72.79 | 85.49 +2016-11-15 13:00:00-05 | 79.62 | 73.69 | 86.49 +2016-11-15 14:00:00-05 | 80.62 | 74.29 | 87.49 +2016-11-15 15:00:00-05 | 81.62 | 75.09 | 88.59 +2016-11-15 16:00:00-05 | 82.63 | 76.09 | 89.89 +2016-11-15 17:00:00-05 | 83.64 | 77.19 | 90.00 +2016-11-15 18:00:00-05 | 84.63 | 77.99 | 90.00 +2016-11-15 19:00:00-05 | 85.58 | 79.09 | 90.00 +2016-11-15 20:00:00-05 | 85.48 | 79.19 | 90.00 +2016-11-15 21:00:00-05 | 84.47 | 78.29 | 89.50 +2016-11-15 22:00:00-05 | 83.48 | 77.09 | 88.49 +2016-11-15 23:00:00-05 | 82.46 | 75.79 | 87.70 +2016-11-16 00:00:00-05 | 81.45 | 75.09 | 86.80 +2016-11-16 01:00:00-05 | 80.45 | 73.89 | 85.70 +2016-11-16 02:00:00-05 | 79.45 | 72.79 | 84.90 +2016-11-16 03:00:00-05 | 78.46 | 71.99 | 84.00 +2016-11-16 04:00:00-05 | 77.48 | 71.09 | 83.00 +2016-11-16 05:00:00-05 | 77.50 | 71.09 | 82.90 +2016-11-16 06:00:00-05 | 78.49 | 71.69 | 84.20 (24 rows) ```