Entity SQL Reference
This section contains Entity SQL reference topics. This topic summarizes and groups the Entity SQL operators by category.
Arithmetic operators perform mathematical operations on two expressions of one or more numeric data types. The following table lists the Entity SQL arithmetic operators.
|% (Modulo)||Returns the remainder of a division.|
Canonical functions are supported by all data providers and can be used by all querying technologies. The following table lists the canonical functions.
|Aggregate Entity SQL Canonical Functions||Discusses aggregate Entity SQL canonical functions.|
|Math Canonical Functions||Discusses math Entity SQL canonical functions.|
|String Canonical Functions||Discusses string Entity SQL canonical functions.|
|Date and Time Canonical Functions||Discusses date and time Entity SQL canonical functions.|
|Bitwise Canonical Functions||Discusses bitwise Entity SQL canonical functions.|
|Other Canonical Functions||Discusses functions not classified as bitwise, date/time, string, math, or aggregate.|
Comparison operators are defined for the following types:
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
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.
|= (Equals)||Compares the equality of two expressions.|
|> (Greater Than)||Compares two expressions to determine whether the left expression has a value greater than the right expression.|
|>= (Greater Than or Equal To)||Compares two expressions to determine whether the left expression has a value greater than or equal to the right expression.|
|IS [NOT] NULL||Determines if a query expression is null.|
|< (Less Than)||Compares two expressions to determine whether the left expression has a value less than the right expression.|
|<= (Less Than or Equal To)||Compares two expressions to determine whether the left expression has a value less than or equal to the right expression.|
|[NOT] BETWEEN||Determines whether an expression results in a value in a specified range.|
|!= (Not Equal To)||Compares two expressions to determine whether the left expression is not equal to the right expression.|
|[NOT] LIKE||Determines whether a specific character string matches a specified pattern.|
Logical operators test for the truth of a condition. The CASE expression evaluates a set of Boolean expressions to determine the result. The following table lists the logical and CASE expression operators.
|&& (Logical AND)||Logical AND.|
|! (Logical NOT)||Logical NOT.|
||| (Logical OR)||Logical OR.|
|CASE||Evaluates a set of Boolean expressions to determine the result.|
|THEN||The result of a WHEN clause when it evaluates to true.|
Query operators are used to define query expressions that return entity data. The following table lists query operators.
|FROM||Specifies the collection that is used in SELECT statements.|
|GROUP BY||Specifies groups into which objects that are returned by a query (SELECT) expression are to be placed.|
|GroupPartition||Returns a collection of argument values, projected off the group partition to which the aggregate is related.|
|HAVING||Specifies a search condition for a group or an aggregate.|
|LIMIT||Used with the ORDER BY clause to performed physical paging.|
|ORDER BY||Specifies the sort order that is used on objects returned in a SELECT statement.|
|SELECT||Specifies the elements in the projection that are returned by a query.|
|SKIP||Used with the ORDER BY clause to performed physical paging.|
|TOP||Specifies that only the first set of rows will be returned from the query result.|
|WHERE||Conditionally filters data that is returned by a query.|
A reference is a logical pointer (foreign key) to a specific entity in a specific entity set. Entity SQL supports the following operators to construct, deconstruct, and navigate through references.
|CREATEREF||Creates references to an entity in an entity set.|
|DEREF||Dereferences a reference value and produces the result of that dereference.|
|KEY||Extracts the key of a reference or of an entity expression.|
|NAVIGATE||Allows you to navigate over the relationship from one entity type to another|
|REF||Returns a reference to an entity instance.|
Entity SQL provides various powerful set operations. This includes set operators similar to Transact-SQL operators such as UNION, INTERSECT, EXCEPT, and EXISTS. Entity SQL also supports operators for duplicate elimination (SET), membership testing (IN), and joins (JOIN). The following table lists the Entity SQL set operators.
|ANYELEMENT||Extracts an element from a multivalued collection.|
|EXCEPT||Returns a collection of any distinct values from the query expression to the left of the EXCEPT operand that are not also returned from the query expression to the right of the EXCEPT operand.|
|[NOT] EXISTS||Determines if a collection is empty.|
|FLATTEN||Converts a collection of collections into a flattened collection.|
|[NOT] IN||Determines whether a value matches any value in a collection.|
|INTERSECT||Returns a collection of any distinct values that are returned by both the query expressions on the left and right sides of the INTERSECT operand.|
|OVERLAPS||Determines whether two collections have common elements.|
|SET||Used to convert a collection of objects into a set by yielding a new collection with all duplicate elements removed.|
|UNION||Combines the results of two or more queries into a single collection.|
Entity SQL provides operations that allow the type of an expression (value) to be constructed, queried, and manipulated. The following table lists operators that are used to work with types.
|CAST||Converts an expression of one data type to another.|
|COLLECTION||Used in a FUNCTION operation to declare a collection of entity types or complex types.|
|IS [NOT] OF||Determines whether the type of an expression is of the specified type or one of its subtypes.|
|OFTYPE||Returns a collection of objects from a query expression that is of a specific type.|
|Named Type Constructor||Used to create instances of entity types or complex types.|
|MULTISET||Creates an instance of a multiset from a list of values.|
|ROW||Constructs anonymous, structurally typed records from one or more values.|
|TREAT||Treats an object of a particular base type as an object of the specified derived type.|
The following table lists other Entity SQL operators.
|+ (String Concatenation)||Used to concatenate strings in Entity SQL.|
|. (Member Access)||Used to access the value of a property or field of an instance of structural conceptual model type.|
|-- (Comment)||Include Entity SQL comments.|
|FUNCTION||Defines an inline function that can be executed in an Entity SQL query.|