1) count () function
Returns the number of non-null values in an (field) field.
Grammar:
SELECT COUNT (<field_key>) from <measurement_name> [WHERE <stuff>] [GROUP by <stuff>]
Example:
>select COUNT (water_level) from H2o_feetname:h2o_feet--------------time count1970-01-01t00:0 0:00z 15258
Description Water_level This field has a total of 15,258 data in the H2o_feet table.
Note: The function in Influxdb will default to epoch 0 (1970-01-01t00:00:00z) as time if no time is specified.
You can add a time condition to the where, as follows:
> SELECT COUNT (water_level) from H2o_feet WHERE time >= ' 2015-08-18t00:00:00z ' and Time < ' 2015-09-18t17:00:00z ' GROUP by Time (4d) Name:h2o_feet--------------time count2015-08-17t00:00:00z 14402015-08-21t0 0:00:00z 19202015-08-25t00:00:00z 19202015-08-29t00:00:00z 19202015-09-02t00:00:00z 19152015-09-06T00:00:0 0Z 19202015-09-10t00:00:00z 19202015-09-14t00:00:00z 19202015-09-18t00:00:00z 335
The result will contain the time result.
2) DISTINCT () function
Returns the unique value of a field.
Grammar:
SELECT DISTINCT (<field_key>) from <measurement_name> [WHERE <stuff>] [GROUP by <stuff>]
Using the example
> select DISTINCT ("Level description") from H2o_feetname:h2o_feet--------------time DISTINCT 1970-01-01T00:00:00Z between 6 and 9 feet1970-01-01t00:00:00z below 3 feet1970-01-01t00:00:00z between 3 and 6 FEET1970-01-01T00:00:00Z at or greater than 9 feet
This example shows that level description has a total of four values, and then it is displayed with the default time.
3) MEAN () function
Returns the arithmetic mean (average) of a value in a field. The field type must be Long integer or float64.
Syntax format:
SELECT MEAN (<field_key>) from <measurement_name> [WHERE <stuff>] [GROUP by <stuff>]
Using the example
> SELECT MEAN (water_level) from H2o_feetname:h2o_feet--------------time mean1970-01-01t00:00 : 00Z 4.286791371454075
Description The average of the Water_level field is 4.286791371454075
Time is the default time, of course, you can also join the Where condition.
4) MEDIAN () function
Returns the median (median) value from the sorted value in a single field. The type of the field value must be a long integer or float64 format.
Grammar:
SELECT MEDIAN (<field_key>) from <measurement_name> [WHERE <stuff>] [GROUP by <stuff>]
Using the example
> SELECT MEDIAN (water_level) from H2o_feetname:h2o_feet--------------time median1970-01-01t0 0:00:00z 4.124
The median number of water_level fields in the description table is 4.124
5) SPREAD () function
Returns the difference between the minimum and maximum values of a field. The type of the data must be long integer or float64.
Grammar:
SELECT SPREAD (<field_key>) from <measurement_name> [WHERE <stuff>] [GROUP by <stuff>]
Using the example
> SELECT SPREAD (water_level) from H2o_feetname:h2o_feet--------------time spread1970-01-01t 00:00:00z 10.574
6) SUM () function
Returns the and of all the values in a field. The type of the field must be long integer or float64.
Grammar:
SELECT SUM (<field_key>) from <measurement_name> [WHERE <stuff>] [GROUP by <stuff>]
Examples of Use:
> SELECT SUM (water_level) from H2o_feetname:h2o_feet--------------time sum1970-01-01t00:00:0 0Z 67777.66900000002
This article is from the "DBSpace" blog, so be sure to keep this source http://dbspace.blog.51cto.com/6873717/1880954
INFLUXDB Learning influxdb Common functions (i) Aggregate class functions