Data exploration
InfluxQL is a SQL-like query language for interacting with data in TSDB For InfluxDB®. This document describes the InfluxQL SELECT statement and useful query syntax.
Basics | Configure query results | Query syntax tips |
The SELECT statement | ORDER BY time DESC | Time syntax |
The WHERE clause | The LIMIT and SLIMIT clauses | Regular expressions |
The GROUP BY clause | The OFFSET and SOFFSET clauses | Data types and casting |
The INTO clause | The time zone clause | Merging |
- | - | Multiple statements |
- | - | Subqueries |
Sample data
The examples in this document use public data from the National Oceanic and Atmospheric Administration (NOAA) Center for Operational Oceanographic Products and Services. The following steps show you how to run queries against this data.
First, log on to the InfluxDB command-line interface (CLI):
$ influx -ssl -username <username> -password <password> -host <network_address> -port 3242 -precision rfc3339 -database NOAA_water_database
Connected to https://<network_address>:3242 version 1.7.x
InfluxDB shell 1.7.x
>Next, review the sample data from the `h2o_feet` measurement.
name: h2o_feet
time | level description | location | water_level |
2015-08-18T00:00:00Z | between 6 and 9 feet | coyote_creek | 8.12 |
2015-08-18T00:00:00Z | below 3 feet | santa_monica | 2.064 |
2015-08-18T00:06:00Z | between 6 and 9 feet | coyote_creek | 8.005 |
2015-08-18T00:06:00Z | below 3 feet | santa_monica | 2.116 |
2015-08-18T00:12:00Z | between 6 and 9 feet | coyote_creek | 7.887 |
2015-08-18T00:12:00Z | below 3 feet | santa_monica | 2.028 |
The data in `h2o_feet` is recorded at six minute intervals. `h2o_feet` has one tag key, `location`, with two tag values: `coyote_creek` and `santa_monica`. `h2o_feet` also has two fields. The `level description` field stores string values, and the `water_level` field stores floating-point values. All of this data is in the `NOAA_water_database` database.
The `level description` field is not part of the original NOAA data. We added this field to provide field values that contain special characters and strings.