Skip to main content

Comparison Operators

OperatorDescriptionSyntaxExample
<Less thanA<BProfit < Cost
<=Less than or equalA<=BProfit <=Cost
>Greater thanA>=BProfit >Cost
>=Greater than or equalA>=BProfit >=Cost
<>Not EqualA<>BProfit1<>Profit2
IS NULLWhether value is nullvalue IS NULLprofit IS NULL
IS NOT NULLWhether value is not nullvalue IS NOT NULLprofit IS NOT NULL
IS DISTINCT FROMWhether two values are not equal, treating null values as the samevalue1 IS DISTINCT FROM value2profit1 IS DISTINCT FROM profit2
IS NOT DISTINCT FROMWhether two values are equal, treating null values as the samevalue1 IS NOT DISTINCT FROM value2profit1 IS NOT DISTINCT FROM profit2
BETWEENReturn true if the specified value is greater than or equal to value1 and less than or equal to value2A BETWEEN value1 AND value2profit BETWEEN 1 AND 1000 Date BETWEEN '2016-01-01' AND '2016-12-30'
NOT BETWEENWhether value1 is less than value2 or greater than value3value1 NOT BETWEEN value2 AND value3profit NOT BETWEEN 1 AND 1000 Date NOT BETWEEN '2016-01-01' AND '2016-12-30'
LIKEWhether string1 matches pattern string2, string1 and string2 are string typesstring1 LIKE string2name LIKE '%frank%'
NOT LIKEWhether string1 does not match pattern string2, string1 and string2 are string typesstring1 NOT LIKE string2 [ ESCAPE string3 ]name NOT LIKE '%frank%'
SIMILAR TOWhether string1 matches string2 in regular expressionstring1 SIMILAR TO string2name SIMILAR TO 'frank'
NOT SIMILAR TOWhether string1 does not match string2 in regular expressionstring1 NOT SIMILAR TO string2name NOT SIMILAR TO 'frank'

Limitations

  • The current SIMILAR TO ESCAPE syntax is limited to scenarios that support adding and hitting the model in SQL statements, and other scenarios such as adding computable columns.
  • The string literals including specific symbols need to be escaped by default and the escape character is \. For example, to match \kylin , it should be using \\kylin. For SIMILAR TO and NOT SIMILAR TO function, the functions use regex match and there is an escaped process. For example, for \\\\kylin, the result will be true when using SIMILAR TO to compare with \kylin and \\kylin.