1) BOTTOM () function
Function: Returns the smallest n values in a field. The field type must be a long integer or float64 type.
Grammar:
SELECT BOTTOM (<field_key>[,<tag_keys>],<N>) [, <tag_keys>] from <measurement_name> [ WHERE <stuff>] [GROUP by <stuff>]
Using the example
> SELECT BOTTOM (water_level,3) from H2o_feetname:h2o_feet--------------time bottom2015-08-29 t14:30:00z-0.612015-08-29t14:36:00z-0.5912015-08-30t15:18:00z-0.594
This example returns the smallest of the three values in the Water_level field in a table.
The associated tag can also be queried, but if the tag value is less than n, the number of values returned will only take the one with the less field value in the tag.
As shown below:
> SELECT BOTTOM (water_level,location,3) from H2o_feetname:h2o_feet--------------time BOTTOM location2015-08-29t10:36:00z-0.243 santa_monica2015-08-29t14:30:00z-0.61 Coyote_creek
The statement takes a minimum of three values, but the result returns only 2 values because the location tag has only two values.
2) First () function
Function: Returns the oldest value in a field.
Grammar:
SELECT First (<field_key>) [, <tag_key (s);] from <measurement_name> [WHERE <stuff>] [GROUP by <stuff>]
Example:
> SELECT First (water_level) from h2o_feet WHERE location = ' Santa_monica ' Name:h2o_feet--------------time first2015-08-18t00:00:00z 2.064
This statement returns the value and time of the oldest Water_level field under location for the Santa_monica condition.
3) Last () function
Function: Returns the most recent value in a field.
Grammar:
SELECT last (<field_key>) [, <tag_key (s);] from <measurement_name> [WHERE <stuff>] [GROUP by < Stuff>]
Example:
> SELECT Last (water_level), location from H2o_feet WHERE time >= ' 2015-08-18t00:42:00z ' and Time <= ' 2015-08-18t00 : 54:00z ' Name:h2o_feet--------------time last location2015-08-18t00:54:00z 6.982 Co Yote_creek
4) MAX () function
Function: Returns the maximum value in a field. The field type must be a long integer, Float64, or Boolean type.
Grammar:
SELECT MAX (<field_key>) [, <tag_key (s);] from <measurement_name> [WHERE <stuff>] [GROUP by < Stuff>]
Example:
> SELECT max (water_level), location from H2o_feetname:h2o_feet--------------time MAX Lo cation2015-08-29t07:24:00z 9.964 Coyote_creek
5) MIN () function
Function: Returns the minimum value in a field. The field type must be a long integer, Float64, or Boolean type.
Grammar:
SELECT MIN (<field_key>) [, <tag_key (s);] from <measurement_name> [WHERE <stuff>] [GROUP by < Stuff>]
Example:
> SELECT min (water_level), location from H2o_feetname:h2o_feet--------------time MIN Loc ation2015-08-29t14:30:00z-0.61 Coyote_creek
6) percentile () function
Function: Returns the value of the rank of n for the sorted values. The type of the field must be long integer or float64.
A percent value is an integer or floating-point number between 100 and 0, including 100.
Grammar:
SELECT percentile (<field_key>, <N>) [, <tag_key (s);] from <measurement_name> [WHERE <stuff [GROUP by <stuff>]
Example:
> SELECT percentile (water_level,5), location from H2o_feetname:h2o_feet--------------time Percenti Le location2015-08-28t12:06:00z 1.122 Santa_monica
is to apply the Water_level field to a different location for a percentage, and then take the fifth bit of data.
This article is from the "DBSpace" blog, so be sure to keep this source http://dbspace.blog.51cto.com/6873717/1880955
The INFLUXDB function of Influxdb Learning (II.) Selecting a class function