---
title: Explore data using InfluxQL
description: Explore time series data using InfluxQL, InfluxData’s SQL-like query language. Use the SELECT statement to query data from measurements, tags, and fields.
url: https://docs.influxdata.com/influxdb/v2/query-data/influxql/explore-data/
estimated_tokens: 4549
product: InfluxDB OSS v2
version: v2
---

# Explore data using InfluxQL

This page documents an earlier version of InfluxDB OSS. [InfluxDB 3 Core](/influxdb3/core/) is the latest stable version.

#### API token hashing is enabled by default in InfluxDB OSS 2.9.0

Stronger token security: tokens are stored as hashes on disk, so a copy of the database file doesn’t expose usable tokens. Existing tokens are hashed on first startup and the original strings can’t be recovered afterward — **capture any plaintext tokens you still need before you upgrade**.

For more information, see [Token hashing](/influxdb/v2/admin/tokens/#token-hashing).

To start exploring data with InfluxQL, do the following:

1. Verify your bucket has a database and retention policy (DBRP) mapping by [listing DBRP mappings for your bucket](/influxdb/v2/query-data/influxql/dbrp/#list-dbrp-mappings). If not, [create a new DBRP mapping](/influxdb/v2/query-data/influxql/dbrp/#create-dbrp-mappings).
    
2. [Configure timestamps in the InfluxQL shell](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/).
    
3. *(Optional)* If you would like to use the data used in the examples below, [download the NOAA sample data](#download-sample-data).
    
4. Use the InfluxQL `SELECT` statement with other key clauses to explore your data.
    

-   [SELECT statement](#select-statement)
-   [WHERE clause](#where-clause)
-   [GROUP BY clause](#group-by-clause)
-   [ORDER BY clause](#order-by-clause)
-   [LIMIT and SLIMIT clauses](#limit-and-slimit-clauses)
-   [OFFSET and SOFFSET clauses](#offset-and-soffset-clauses)
-   [Time and timezone queries](#time-and-timezone-queries)
-   [Subqueries](#subqueries)
-   [Regular expressions](#regular-expressions)

### [SELECT statement](/influxdb/v2/query-data/influxql/explore-data/select/)

Use the `SELECT` statement to query data from a particular [measurement](/influxdb/v2/reference/glossary/#measurement) or measurements.

```sql
SELECT <field_key>[,<field_key>,<tag_key>] FROM <measurement_name>[,<measurement_name>]
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/select/)

### [WHERE clause](/influxdb/v2/query-data/influxql/explore-data/where/)

Use the `WHERE` clause to filter data based on [fields](/influxdb/v2/reference/glossary/#field), [tags](/influxdb/v2/reference/glossary/#tag), and/or [timestamps](/influxdb/v2/reference/glossary/#timestamp).

```sql
SELECT_clause FROM_clause WHERE <conditional_expression> [(AND|OR) <conditional_expression> [...]]
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/where/)

### [GROUP BY clause](/influxdb/v2/query-data/influxql/explore-data/group-by/)

Use the `GROUP BY` clause to group query results by one or more specified [tags](/influxdb/v2/reference/glossary/#tag) and/or a specified time interval.

```sql
SELECT_clause FROM_clause [WHERE_clause] GROUP BY [* | <tag_key>[,<tag_key]]
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/group-by/)

### [ORDER BY clause](/influxdb/v2/query-data/influxql/explore-data/order-by/)

Use the `ORDER BY` clause to sort data in ascending or descending order.

```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] ORDER BY time DESC
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/order-by/)

### [LIMIT and SLIMIT clauses](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)

Use the `LIMIT` and `SLIMIT` clauses to limit the number of [points](/influxdb/v2/reference/glossary/#point) and [series](/influxdb/v2/reference/glossary/#series) returned in queries.

```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT <N>
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/limit-and-slimit/)

### [OFFSET and SOFFSET clauses](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/)

Use the `OFFSET` and `SOFFSET` clauses to paginate [points](/influxdb/v2/reference/glossary/#point) and [series](/influxdb/v2/reference/glossary/#series).

```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] LIMIT_clause OFFSET <N> [SLIMIT_clause]
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/offset-and-soffset/)

### [Time and timezone queries](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/)

Explore InfluxQL features used specifically for working with time. Use the `tz` (timezone) clause to return the UTC offset for the specified timezone.

```sql
SELECT_clause FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] [SLIMIT_clause] [SOFFSET_clause] tz('<time_zone>')
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/time-and-timezone/)

### [Subqueries](/influxdb/v2/query-data/influxql/explore-data/subqueries/)

Use a `subquery` to apply a query as a condition in the enclosing query.

```sql
SELECT_clause FROM ( SELECT_statement ) [...]
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/subqueries/)

### [Regular expressions](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)

Use `regular expressions` to match patterns in your data.

```sql
SELECT /<regular_expression_field_key>/ FROM /<regular_expression_measurement>/ WHERE [<tag_key> <operator> /<regular_expression_tag_value>/ | <field_key> <operator> /<regular_expression_field_value>/] GROUP BY /<regular_expression_tag_key>/
```

[Read more](/influxdb/v2/query-data/influxql/explore-data/regular-expressions/)

## Download sample data

The example InfluxQL queries in this documentation use publicly available [National Oceanic and Atmospheric Administration (NOAA)](https://www.noaa.gov/) data.

To download a subset of NOAA data used in examples, run the script under [NOAA water sample data](/influxdb/v2/reference/sample-data/#noaa-water-sample-data) (for example, copy and paste the script into your Data Explorer - Script Editor), and replace “example-org” in the script with the name of your InfluxDB organization.

Let’s get acquainted with this subsample of the data in the `h2o_feet` measurement:

Output:

Name: h2o\_feet

| time | level description | location | water_level |
| --- | --- | --- | --- |
| 2019-08-18T00:00:00Z | between 6 and 9 feet | coyote_creek | 8.1200000000 |
| 2019-08-18T00:00:00Z | below 3 feet | santa_monica | 2.0640000000 |
| 2019-08-18T00:06:00Z | between 6 and 9 feet | coyote_creek | 8.0050000000 |
| 2019-08-18T00:06:00Z | below 3 feet | santa_monica | 2.1160000000 |
| 2019-08-18T00:12:00Z | between 6 and 9 feet | coyote_creek | 7.8870000000 |
| 2019-08-18T00:12:00Z | below 3 feet | santa_monica | 2.0280000000 |

The data in the `h2o_feet` [measurement](/influxdb/v2/reference/glossary/#measurement) occurs at six-minute time intervals. This measurement has one [tag key](/influxdb/v2/reference/glossary/#tag-key) (`location`) which has two [tag values](/influxdb/v2/reference/glossary/#tag-value): `coyote_creek` and `santa_monica`. The measurement also has two [fields](/influxdb/v2/reference/glossary/#field): `level description` stores string [field values](/influxdb/v2/reference/glossary/#field-value) and `water_level` stores float field values.

### Configure timestamps in the InfluxQL shell

By default, the [InfluxQL shell](/influxdb/v2/tools/influxql-shell/) returns timestamps in nanosecond UNIX epoch format by default. To return human-readable RFC3339 timestamps instead of Unix nanosecond timestamps, use the [precision helper command](/influxdb/v2/tools/influxql-shell/#precision) \` to configure the timestamp format:

```sql
precision rfc3339
```

The [InfluxDB API](/influxdb/v2/reference/api/influxdb-1x/) returns timestamps in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format by default. Specify alternative formats with the [`epoch` query string parameter](/influxdb/v2/reference/api/influxdb-1x/).
