Adds a value to a set. If the value is a collection, then it is merged with the set, otherwise <value> is added.
Syntax − set(<field>)
2
map():
Adds a value to a map the first time the map is created. If <value> is a map, then it is merged with the map, otherwise the pair <key> and <value> is added to map as new entry.
Syntax − map(<key>, <value>)
3
ist():
Adds a value to list the first time the list is created. If <value> is a collection, then it is merged with the list, otherwise <value> is added to list.
Syntax − list(<field>)
4
difference():
Works as aggregate or inline. If only one argument is passed then aggregates, otherwise executes, and returns the DIFFERENCE between the collections received as parameters.
Syntax − difference(<field> [,<field-n>]*)
5
first():
Retrieves only the first item of multi-value fields (arrays, collections and maps). For non-multi-value types just returns the value.
Syntax − first(<field>)
6
intersect():
Works as aggregate or inline. If only one argument is passed then aggregates, otherwise executes, and returns, the INTERACTION of the collections received as parameters.
Syntax − intersect(<field> [,<field-n>]*)
7
distinct():
Retrieves only unique data entries depending on the field you have specified as argument. The main difference compared to standard SQL DISTINCT is that with OrientDB, a function with parenthesis and only one field can be specified.
Syntax − distinct(<field>)
8
expand():
This function has two meanings−
When used on a collection field, it unwinds the collection in the field and uses it as result.
When used on a link (RID) field, it expands the document pointed by that link.
Syntax − expand(<field>)
9
unionall():
Works as aggregate or inline. If only one argument is passed then aggregates, otherwise executes and returns a UNION of all the collections received as parameters. Also works with no collection values.
Syntax − unionall(<field> [,<field-n>]*)
10
flatten():
Extracts the collection in the field and uses it as result. It is deprecated, use expand() instead.
Syntax − flatten(<field>)
11
last():
Retrieves only the last item of multi-value fields (arrays, collections and maps). For non-multi-value types just returns the value.
Syntax − last(<field>)
12
symmetricDifference():
Works as aggregate or inline. If only one argument is passed then aggregates, otherwise executes, and returns, the SYMMETRIC DIFFERENCE between the collections received as parameters.
orientdb {db = demo}> SELECT if(eval("name = 'satish'"), "My name is satish",
"My name is not satish") FROM Employee
如果上述查询执行成功,您将获得以下输出。
----+--------+-----------------------
# |@CLASS | IF
----+--------+-----------------------
0 |null |My name is satish
1 |null |My name is not satish
2 |null |My name is not satish
3 |null |My name is not satish
4 |null |My name is not satish
----+--------+------------------------
执行以下查询以获取系统日期。
orientdb {db = demo}> SELECT SYSDATE() FROM Employee