You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{% expand "Return the average temperature of all rooms" %}}
125
+
126
+
{{< code-tabs-wrapper >}}
127
+
{{% code-tabs %}}
128
+
[SQL](#)
129
+
[InfluxQL](#)
130
+
{{% /code-tabs %}}
131
+
{{% code-tab-content %}}
132
+
```sql
133
+
SELECTavg(temp) AS avg_temp FROM home
134
+
```
135
+
{{% /code-tab-content %}}
136
+
{{% code-tab-content %}}
137
+
```sql
138
+
SELECT MEAN(temp) AS avg_temp FROM home
84
139
```
140
+
{{% /code-tab-content %}}
141
+
{{< /code-tabs-wrapper >}}
85
142
86
-
#### Example: query the `cpu` table, limiting to 10 rows:
87
-
88
-
```console
89
-
$ influxdb3 query --database servers "SELECT DISTINCT usage_percent, time FROM cpu LIMIT 10"
90
-
+---------------+---------------------+
91
-
| usage_percent | time |
92
-
+---------------+---------------------+
93
-
| 63.4 | 2024-02-21T19:25:00 |
94
-
| 25.3 | 2024-02-21T19:06:40 |
95
-
| 26.5 | 2024-02-21T19:31:40 |
96
-
| 70.1 | 2024-02-21T19:03:20 |
97
-
| 83.7 | 2024-02-21T19:30:00 |
98
-
| 55.2 | 2024-02-21T19:00:00 |
99
-
| 80.5 | 2024-02-21T19:05:00 |
100
-
| 60.2 | 2024-02-21T19:33:20 |
101
-
| 20.5 | 2024-02-21T18:58:20 |
102
-
| 85.2 | 2024-02-21T19:28:20 |
103
-
+---------------+---------------------+
143
+
{{% /expand %}}
144
+
{{% expand "Return the average temperature of the kitchen" %}}
145
+
146
+
{{< code-tabs-wrapper >}}
147
+
{{% code-tabs %}}
148
+
[SQL](#)
149
+
[InfluxQL](#)
150
+
{{% /code-tabs %}}
151
+
{{% code-tab-content %}}
152
+
```sql
153
+
SELECTavg(temp) AS avg_temp FROM home WHERE room ='Kitchen'
154
+
```
155
+
{{% /code-tab-content %}}
156
+
{{% code-tab-content %}}
157
+
```sql
158
+
SELECT MEAN(temp) AS avg_temp FROM home WHERE room ='Kitchen'
104
159
```
160
+
{{% /code-tab-content %}}
161
+
{{< /code-tabs-wrapper >}}
105
162
106
-
### Query using the CLI for InfluxQL
163
+
{{% /expand %}}
164
+
{{% expand "Query data from an absolute time range" %}}
107
165
108
-
[InfluxQL](/influxdb3/version/reference/influxql/) is an SQL-like language developed by InfluxData with specific features tailored for leveraging and working with InfluxDB. It’s compatible with all versions of InfluxDB, making it a good choice for interoperability across different InfluxDB installations.
166
+
{{% influxdb/custom-timestamps %}}
109
167
110
-
To query using InfluxQL, enter the `influxdb3 query` subcommand and specify `influxql` in the language option--for example:
0 commit comments