Relational

A relational expression returns the Boolean result of a relational comparison of its operands.

Expression

Character representation

Returns

Relational

< lt

True (1) when the first operand is less than the second operand, and false (0) when the first operand is larger than the second operand.

 

> gt

True (1) when the first operand is greater than the second operand, and false (0) when the first operand is less than the second operand.

 

<= le

True (1) when the first operand is less than or equal to the second operand, and false (0) when the first operand is greater than the second operand.

 

>= ge

True (1) when the first operand is greater than or equal to the second operand, and false (0) when the first operand is less than the second operand.

The following special cases also apply when using relational operators:

  • If either operand is null valued, a null comparison is performed. Null-valued operands compare identically whenever both operands are null and the relational operator is less-than-or-equal or greater than or equal, and compare differently otherwise.

  • If both operands are string valued, a locale-sensitive lexicographic string comparison is performed on the operands. Otherwise, if they are not both null, the operands are promoted to numeric values, and a numeric comparison is performed.

These are examples of using the relational expression:

Expression

Returns

3 < 3

0 (false)

3 > 4

0 (false)

"abc" <= "def"

1 (true)

"def" > "abc"

1 (true)

12 >= 12

1 (true)

"true" < "false"

0 (false)

// Ethnio survey code removed