Επεξεργασία

Κοινή χρήση μέσω


Azure Digital Twins query language reference: Operators

This document contains reference information on operators for the Azure Digital Twins query language.

Comparison operators

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.

Example

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

Contains operators

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.

Example

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']

Logical operators

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.

Example

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

Limitations

The following limits apply to queries using operators.

See the section below for more details.

Limit for IN/NIN

The limit for the number of values that can be included in an IN or NIN set is 100 values.