# 实体 SQL 引用Entity SQL reference

## 算术运算符Arithmetic operators

/（除）/ (Divide) 除。Division.
%（取模）% (Modulo) 返回除法运算的余数。Returns the remainder of a division.
*（乘）* (Multiply) 乘。Multiplication.
-（负）- (Negative) 求反。Negation.
-（减）- (Subtract) 减。Subtraction.

## 比较运算符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.

<（小于）< (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 isn't equal to the right expression.
[不 ] 类似于[NOT] LIKE 确定特定字符串是否与指定模式相匹配。Determines whether a specific character string matches a specified pattern.

## 逻辑和 case 表达式运算符Logical and case expression operators

(逻辑与)&& && (Logical AND) 逻辑 AND。Logical AND.
! (逻辑非) ! (Logical NOT) 逻辑非。Logical NOT.
|| (逻辑或) || (Logical OR) 逻辑 OR。Logical OR.
CASECASE 求出一组布尔表达式的值以确定结果。Evaluates a set of Boolean expressions to determine the result.
THENTHEN when 子句的计算结果为 true 时的结果。The result of a WHEN clause when it evaluates to true.

## 查询运算符Query operators

FROMFROM 指定在 SELECT 语句中使用的集合。Specifies the collection that is used in SELECT statements.
GROUP BYGROUP BY 指定由查询返回的对象 (选择 要放置) 表达式的组。Specifies groups into which objects that are returned by a query (SELECT) expression are to be placed.
GroupPartitionGroupPartition 返回从聚合与之相关的组分区提取的参数值集合。Returns a collection of argument values, projected off the group partition to which the aggregate is related.
HAVINGHAVING 指定组或聚合的搜索条件。Specifies a search condition for a group or an aggregate.

ORDER BYORDER BY 指定在 SELECT 语句中返回的对象上使用的排序顺序。Specifies the sort order that is used on objects returned in a SELECT statement.
SELECTSELECT 指定投影中由查询返回的元素。Specifies the elements in the projection that are returned by a query.
SKIP ORDER BY 子句一起使用，以执行物理分页。Used with the ORDER BY clause to performed physical paging.
TOPTOP 指定查询结果中将只返回第一组行。Specifies that only the first set of rows will be returned from the query result.
WHEREWHERE 按条件筛选由查询返回的数据。Conditionally filters data that is returned by a query.

## Reference 运算符Reference operators

CREATEREFCREATEREF 创建对实体集中的实体的引用。Creates references to an entity in an entity set.
DEREFDEREF 取消引用一个引用值，并生成该取消引用的结果。Dereferences a reference value and produces the result of that dereference.
KEYKEY 提取引用或实体表达式的键。Extracts the key of a reference or of an entity expression.

REFREF 返回对实体实例的引用。Returns a reference to an entity instance.

## 集合运算符Set operators

ANYELEMENTANYELEMENT 从多值集合中提取元素。Extracts an element from a multivalued collection.
EXCEPTEXCEPT 返回一个集合，该集合中的所有非重复值都是从除除运算符右侧的查询表达式返回的查询表达式中的任何非重复值。Returns a collection of any distinct values from the query expression to the left of the EXCEPT operand that aren't 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.
INTERSECTINTERSECT 返回 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.
OVERLAPSOVERLAPS 确定两个集合是否具有公共元素。Determines whether two collections have common elements.
SETSET 用于通过生成一个新集合（其中移除了所有重复元素）将对象集合转换为一个集。Used to convert a collection of objects into a set by yielding a new collection with all duplicate elements removed.
UNIONUNION 将两个或更多查询的结果组合成单个集合。Combines the results of two or more queries into a single collection.

## 类型运算符Type operators

CASTCAST 将一种数据类型的表达式转换为另一种数据类型的表达式。Converts an expression of one data type to another.

[不是 ]IS [NOT] OF 确定表达式的类型是否为指定类型或指定类型的某个子类型。Determines whether the type of an expression is of the specified type or one of its subtypes.
OFTYPEOFTYPE 从查询表达式返回特定类型的对象集合。Returns a collection of objects from a query expression that is of a specific type.

MULTISETMULTISET 根据值列表创建多集的实例。Creates an instance of a multiset from a list of values.
ROWROW 从一个或多个值构造结构上类型化的匿名记录。Constructs anonymous, structurally typed records from one or more values.
TREATTREAT 将特定基类型的对象视为指定派生类型的对象。Treats an object of a particular base type as an object of the specified derived type.

## 其他运算符Other operators

+（字符串串联）+ (String Concatenation) 用于在实体 SQL 中串联字符串。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) 包括实体 SQL 注释。Include Entity SQL comments.
FUNCTIONFUNCTION 定义可在 Entity SQL 查询中执行的内联函数。Defines an inline function that can be executed in an Entity SQL query.