Training
Module
Combine query results with set operators - Training
Combine query results with set operators using Transact-SQL.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This document contains reference information on operators for the Azure Digital Twins query language.
The following operators from the comparison family are supported.
=
, !=
: Used to compare equality of expressions.<
, >
: Used for ordered comparison of expressions.<=
, >=
: Used for ordered comparison of expressions, including equality.Here's an example using =
. The following query returns twins whose Temperature value is equal to 80.
SELECT *
FROM DIGITALTWINS DT
WHERE DT.Temperature = 80
Here's an example using <
. The following query returns twins whose Temperature value is less than 80.
SELECT *
FROM DIGITALTWINS DT
WHERE DT.Temperature < 80
Here's an example using <=
. The following query returns twins whose Temperature value is less than or equal to 80.
SELECT *
FROM DIGITALTWINS DT
WHERE NOT DT.Temperature <= 80
The following operators from the contains family are supported.
IN
: Evaluates to true if a given value is in a set of values.NIN
: Evaluates to true if a given value isn't in a set of values.Here's an example using IN
. The following query returns twins whose owner
property is one of several options from a list.
SELECT *
FROM DIGITALTWINS DT
WHERE DT.owner IN ['John', 'Anil', 'Bailey', 'Alex']
The following operators from the logical family are supported:
AND
: Used to connect two expressions, evaluates to true if they're both true.OR
: Used to connect two expressions, evaluates to true if at least one of them is true.NOT
: Used to negate an expression, evaluates to true if the expression condition isn't met.Here's an example using AND
. The following query returns twins who meet both conditions of Temperature less than 80 and Humidity less than 50.
SELECT *
FROM DIGITALTWINS DT
WHERE DT.Temperature < 80 AND DT.Humidity < 50
Here's an example using OR
. The following query returns twins who meet at least one of the conditions of Temperature less than 80 and Humidity less than 50.
SELECT *
FROM DIGITALTWINS DT
WHERE DT.Temperature < 80 OR DT.Humidity < 50
Here's an example using NOT
. The following query returns twins who don't meet the conditions of Temperature less than 80.
SELECT *
FROM DIGITALTWINS DT
WHERE NOT DT.Temperature < 80
The following limits apply to queries using operators.
See the section below for more details.
The limit for the number of values that can be included in an IN
or NIN
set is 100 values.
Training
Module
Combine query results with set operators - Training
Combine query results with set operators using Transact-SQL.