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
Copy file name to clipboardExpand all lines: articles/iot-hub/iot-hub-devguide-query-language.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: SoniaLopezBravo
5
5
6
6
ms.service: azure-iot-hub
7
7
ms.topic: concept-article
8
-
ms.date: 09/29/2022
8
+
ms.date: 03/28/2025
9
9
ms.author: sonialopez
10
10
ms.custom: devx-track-csharp
11
11
---
@@ -15,9 +15,9 @@ ms.custom: devx-track-csharp
15
15
IoT Hub provides a powerful SQL-like language to retrieve information regarding [device twins](iot-hub-devguide-device-twins.md), [module twins](iot-hub-devguide-module-twins.md), [jobs](iot-hub-devguide-jobs.md), and [message routing](iot-hub-devguide-messages-d2c.md). This article presents:
16
16
17
17
* An introduction to the major features of the IoT Hub query language, and
18
-
* The detailed description of the language. For details on query language for message routing, see [queries in message routing](../iot-hub/iot-hub-devguide-routing-query-syntax.md).
18
+
* The detailed description of the language. For more information about query language for message routing, see [IoT Hub message routing query syntax](../iot-hub/iot-hub-devguide-routing-query-syntax.md).
19
19
20
-
For specific examples, see [Queries for device and module twins](query-twins.md) or [Queries for jobs](query-jobs.md).
20
+
For specific examples, see [Queries for IoT Hub device and module twins](query-twins.md) or [Queries for IoT Hub jobs](query-jobs.md).
@@ -33,7 +33,7 @@ You also can run queries within your applications using the Azure IoT service SD
33
33
34
34
For example code implementing IoT Hub queries, see the [Query examples with the service SDKs](#query-examples-with-the-service-sdks) section.
35
35
36
-
For links to SDK reference pages and samples, see [Azure IoT SDKs](iot-hub-devguide-sdks.md).
36
+
For links to SDK reference pages and samples, see [Azure IoT Hub SDKs](iot-hub-devguide-sdks.md).
37
37
38
38
## Basics of an IoT Hub query
39
39
@@ -130,7 +130,7 @@ For example:
130
130
WHEREdevices.jobs.deviceId ='myDeviceId'
131
131
```
132
132
133
-
The allowed conditions are described in the [expressions and conditions](#expressions-and-conditions) section.
133
+
The allowed conditions are described in the [Expressions and conditions](#expressions-and-conditions) section.
134
134
135
135
### GROUP BY clause
136
136
@@ -150,7 +150,7 @@ For example:
150
150
Currently, the GROUP BY clause is only supported when querying device twins.
151
151
152
152
> [!CAUTION]
153
-
> The term `group` is currently treated as a special keyword in queries. In case, you use `group` as your property name, consider surrounding it with double brackets to avoid errors, e.g.,`SELECT * FROM devices WHERE tags.[[group]].name = 'some_value'`.
153
+
> The term `group` is currently treated as a special keyword in queries. In case, you use `group` as your property name, consider surrounding it with double brackets to avoid errors, as shown in this example:`SELECT * FROM devices WHERE tags.[[group]].name = 'some_value'`.
154
154
155
155
The formal syntax for GROUP BY is:
156
156
@@ -165,7 +165,7 @@ GROUP BY <group_by_element>
165
165
166
166
### Query results pagination
167
167
168
-
A query object is instantiated with a max page size of **less than** or **equal to** 100 records. To obtain multiple pages, call the [nextAsTwin](device-twins-node.md#create-a-service-app-that-updates-desired-properties-and-queries-twins) on Node.js SDK or [GetNextAsTwinAsync](device-twins-dotnet.md#create-a-service-app-that-updates-desired-properties-and-queries-twins) on .Net SDK method multiple times.
168
+
A query object is instantiated with a max page size of **less than** or **equal to** 100 records. To obtain multiple pages, call the [nextAsTwin](how-to-device-twins.md?pivots=programming-language-node#create-a-device-twin-query) on Node.js SDK or [GetNextAsTwinAsync](how-to-device-twins.md?pivots=programming-language-csharp#create-a-device-twin-query) on .NET SDK method multiple times.
169
169
A query object can expose multiple Next values, depending on the deserialization option required by the query. For example, a query object can return device twin or job objects, or plain JSON when using projections.
170
170
171
171
## Expressions and conditions
@@ -232,7 +232,7 @@ When querying twins and jobs the only supported function is:
232
232
233
233
| Function | Description |
234
234
| -------- | ----------- |
235
-
| IS_DEFINED(property) | Returns a Boolean indicating if the property has been assigned a value (including `null`). |
235
+
| IS_DEFINED(property) | Returns a Boolean indicating if the property is assigned a value (including `null`). |
236
236
237
237
In routes conditions, the following math functions are supported:
238
238
@@ -254,7 +254,7 @@ In routes conditions, the following type checking and casting functions are supp
254
254
| AS_NUMBER | Converts the input string to a number. `noop` if input is a number; `Undefined` if string doesn't represent a number.|
255
255
| IS_ARRAY | Returns a Boolean value indicating if the type of the specified expression is an array. |
256
256
| IS_BOOL | Returns a Boolean value indicating if the type of the specified expression is a Boolean. |
257
-
| IS_DEFINED | Returns a Boolean indicating if the property has been assigned a value. This function is supported only when the value is a primitive type. Primitive types include string, Boolean, numeric, or `null`. DateTime, object types and arrays aren't supported. |
257
+
| IS_DEFINED | Returns a Boolean indicating if the property is a value. This function is supported only when the value is a primitive type. Primitive types include string, Boolean, numeric, or `null`. DateTime, object types, and arrays aren't supported. |
258
258
| IS_NULL | Returns a Boolean value indicating if the type of the specified expression is null. |
259
259
| IS_NUMBER | Returns a Boolean value indicating if the type of the specified expression is a number. |
260
260
| IS_OBJECT | Returns a Boolean value indicating if the type of the specified expression is a JSON object. |
@@ -279,7 +279,7 @@ In routes conditions, the following string functions are supported:
279
279
280
280
### C# example
281
281
282
-
The query functionality is exposed by the [C# service SDK](iot-hub-devguide-sdks.md) in the **RegistryManager** class.
282
+
The query functionality is exposed by the [Azure IoT Hub service SDK for .NET](iot-hub-devguide-sdks.md#azure-iot-hub-service-sdks) in the **RegistryManager** class.
283
283
284
284
Here's an example of a simple query:
285
285
@@ -295,11 +295,11 @@ while (query.HasMoreResults)
295
295
}
296
296
```
297
297
298
-
The query object is instantiated with the parameters mentioned in the [query results pagination](#query-results-pagination) section. Multiple pages are retrieved by calling the **GetNextAsTwinAsync** methods multiple times.
298
+
The query object is instantiated with the parameters mentioned in the [Query results pagination](#query-results-pagination) section. Multiple pages are retrieved by calling the **GetNextAsTwinAsync** methods multiple times.
299
299
300
300
### Node.js example
301
301
302
-
The query functionality is exposed by the [Azure IoT service SDK for Node.js](iot-hub-devguide-sdks.md) in the **Registry** object.
302
+
The query functionality is exposed by the [Azure IoT Hub service SDK for Node.js](iot-hub-devguide-sdks.md#azure-iot-hub-service-sdks) in the **Registry** object.
303
303
304
304
Here's an example of a simple query:
305
305
@@ -322,11 +322,11 @@ var onResults = function(err, results) {
322
322
query.nextAsTwin(onResults);
323
323
```
324
324
325
-
The query object is instantiated with the parameters mentioned in the [query results pagination](#query-results-pagination) section. Multiple pages are retrieved by calling the **nextAsTwin** method multiple times.
325
+
The query object is instantiated with the parameters mentioned in the [Query results pagination](#query-results-pagination) section. Multiple pages are retrieved by calling the **nextAsTwin** method multiple times.
326
326
327
327
## Next steps
328
328
329
329
* Learn about routing messages based on message properties or message body with the [IoT Hub message routing query syntax](iot-hub-devguide-routing-query-syntax.md).
330
-
* Get specific examples of [Queries for device and module twins](query-twins.md) or [Queries for jobs](query-jobs.md).
330
+
* Get specific examples of [Queries for IoT Hub device and module twins](query-twins.md) or [Queries for IoT Hub jobs](query-jobs.md).
0 commit comments