Share via


Comparison Operators (Entity SQL)

Comparison operators are defined for the following types: Byte, Int32, Int16, Int64, Double, Single, Decimal, String, DateTime, Date, Time, DateTimeOffset. Implicit type promotion occurs for the operands before the comparison operator is applied. Comparison operators always yield Boolean values. When at least one of the operands is null, the result is null.

Equality and inequality are defined for any object type that has identity, such as the Boolean type. Non-primitive objects with identity are considered equal if they share the same identity.

The following table lists the Entity SQL comparison operators.

Operator Description

= (Equals) (Entity SQL)

Compares the equality of two expressions.

> (Greater Than) (Entity SQL)

Compares two expressions to determine whether the left expression has a value greater than the right expression.

>= (Greater Than or Equal To) (Entity SQL)

Compares two expressions to determine whether the left expression has a value greater than or equal to the right expression.

IS [NOT] NULL (Entity SQL)

Determines if a query expression is null.

< (Less Than) (Entity SQL)

Compares two expressions to determine whether the left expression has a value less than the right expression.

<= (Less Than or Equal To) (Entity SQL)

Compares two expressions to determine whether the left expression has a value less than or equal to the right expression.

[NOT] BETWEEN (Entity SQL)

Determines whether an expression results in a value in a specified range.

!= (Not Equal To) (Entity SQL)

Compares two expressions to determine whether the left expression is not equal to the right expression.

<> (Not Equal To) (Entity SQL)

Compares two expressions to determine whether the left expression is not equal to the right expression.

[NOT] LIKE (Entity SQL)

Determines whether a specific character string matches a specified pattern.

See Also

Concepts

Operators (Entity SQL)
Operator Precedence (Entity SQL)
Entity SQL Reference