blob: 7ff33e7c011271db4219283fa63a27ec9d271007 [file] [log] [blame]
---
title: Supported Keywords
---
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
| Query Language Keyword | Description | Example |
|------------------------|-------------|---------|
| AND | Logical operator used to create complex expressions by combining two or more expressions to produce a Boolean result. When you combine two conditional expressions using the AND operator, both conditions must evaluate to true for the entire expression to be true. | See [Operators](operators.html#operators) |
| AS | Used to provide a label for a path expression so you can refer to the path by the label later. | See [Aliases and Synonyms](../query_select/the_from_clause.html#the_from_clause__section_AB1734C16DC348479C00FD6829B933AA) |
| AVG | Returns the average arithmetic mean of the set formed by the selected expression. The type of the expression must evaluate to a `java.lang.Number`. | See [AVG](../query_select/aggregates.html#avg) |
| COUNT | Returns the quantity of values in the set formed by the selected expression. | See [COUNT](../query_select/aggregates.html#count) |
| DISTINCT | Restricts the select statement to unique results (eliminates duplicates). | See [DISTINCT](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E__section_972EE73A6F3E4427B6A99DB4EDF5860D) |
| ELEMENT | Query function. Extracts a single element from a collection or array. This function throws a `FunctionDomainException ` if the argument is not a collection or array with exactly one element. | See [Preset Query Functions](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E__section_69DCAD624E9640028BC86FD67649DEB2) |
| FROM | You can access any object or object attribute that is available in the current scope of the query. | See [FROM Clause](../query_select/the_from_clause.html#the_from_clause) |
| GROUP BY | Allows you to summarize data, arranging or grouping results by identical field(s). | See [GROUP BY](../query_select/aggregates.html#groupBy) |
| &lt;HINT&gt; | Keyword that instructs the query engine to prefer certain indexes. | See [Using Query Index Hints](../query_index/query_index_hints.html) |
| IMPORT | Used to establish the name for a class in a query. | See [IMPORT Statement](../query_select/the_import_statement.html#concept_2E9F15B2FE9041238B54736103396BF7) |
| IN | The IN expression is a Boolean indicating whether one expression is present inside a collection of expressions of a compatible type. | See [IN and SET](../query_select/the_where_clause.html#the_where_clause__section_AC12146509F141378E493078540950C7) |
| IS\_DEFINED | Query function. Returns TRUE if the expression does not evaluate to [UNDEFINED](literals.html#literals__section_undefined). Inequality queries include undefined values in their query results. With the IS\_DEFINED function, you can limit results to only those elements with defined values. | See [Preset Query Functions](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E__section_69DCAD624E9640028BC86FD67649DEB2) |
| IS\_UNDEFINED | Query function. Returns TRUE if the expression evaluates to [UNDEFINED](literals.html#literals__section_undefined). With the exception of inequality queries, most queries do not include undefined values in their query results. The IS\_UNDEFINED function allows undefined values to be included, so you can identify elements with undefined values. | See [Preset Query Functions](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E__section_69DCAD624E9640028BC86FD67649DEB2) |
| LIMIT | Limits the number of returned results. If you use the limit keyword, you cannot also run operations on the query result set that perform any kind of summary activities. For example trying to run add or addAll or a SelectResult from a query with a LIMIT clause throws an exception. | See [LIMIT](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E__section_25D7055B33EC47B19B1B70264B39212F) |
| LIKE | LIKE can be used to mean 'equals to', or if you terminate the string with a wildcard character (`%`), it behaves like 'starts with'. Note that the wildcard can only be used at the end of the comparison string. You can escape the wildcard character to represent the `%` character. You can also use the LIKE predicate if an index is present. | See [LIKE](../query_select/the_where_clause.html#the_where_clause__section_D91E0B06FFF6431490CC0BFA369425AD) |
| MIN | Returns the minimum or smallest value from the selected expression. The type of the expression must evaluate to a `java.lang.Comparable`. | See [MIN](../query_select/aggregates.html#min) |
| MAX | Returns the maximum or largest value from the selected expression. The type of the expression must evaluate to a `java.lang.Comparable`. | See [MAX](../query_select/aggregates.html#max) |
| NOT | The example returns the set of portfolios that have positions. Note that NOT cannot use an index. | See [Operators](operators.html#operators) |
| NVL | Returns expr2 if expr1 is null. The expressions can be query parameters (bind arguments), path expressions, or literals. | See [Preset Query Functions](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E__section_69DCAD624E9640028BC86FD67649DEB2) |
| OR | If an expression uses both AND and OR operators, the AND expression has higher precedence than OR. | See [Operators](operators.html#operators) |
| ORDER BY | Allows you to order query results (either in ascending or descending order). | See [ORDER BY](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E__section_D9DF0F785CA94EF8B367C3326CC12990) |
| SELECT | Allows you to filter data from the collection of object(s) returned by a WHERE search operation. | See [SELECT Statement](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E) |
| SET | Specifies a collection of values that can be compared to the returned values of query. | See [IN and SET](../query_select/the_where_clause.html#the_where_clause__section_AC12146509F141378E493078540950C7) |
| SUM | Returns the summation over the set formed by the selected expression. The type of the expression must evaluate to a `java.lang.Number`. | See [SUM](../query_select/aggregates.html#sum) |
| &lt;TRACE&gt; | Enables debugging on the following query string. | See [Query Debugging](query_debugging.html#concept_2D557E24AAB24044A3DB36B3124F6748) |
| TO\_DATE | Returns a Java Data class object. The arguments must be String S with date\_str representing the date and format\_str representing the format used by date\_str. The format\_str you provide is parsed using java.text.SimpleDateFormat. | See [Preset Query Functions](../query_select/the_select_statement.html#concept_85AE7D6B1E2941ED8BD2A8310A81753E__section_69DCAD624E9640028BC86FD67649DEB2) |
| TYPE | Specifying object type in the FROM clause helps the query engine to process the query at optimal speed. | See [Object Typing](../query_select/the_from_clause.html#the_from_clause__section_A5B42CCB7C924949954AEC2DAAD51134) |
| WHERE | Resolves to a collection of objects. The collection is then available for iteration in the query expressions that follow in the WHERE clause. | See [WHERE Clause](../query_select/the_where_clause.html#the_where_clause) |