Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions content/en/docs/refguide/modeling/domain-model/oql/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ OQL queries do not take security into account out-of-the-box. This means that yo
You can try your OQL example online in the [OQL Playground](https://service.mendixcloud.com/p/OQL) demo app.
{{% /alert %}}

## Reserved Words {#reserved-oql-words}
## Syntax basics

An OQL statement consists of [keywords](#reserved-oql-words), identifiers, [value literals](/refguide/oql-expression-syntax/#oql-literals) and [operators](/refguide/oql-expression-syntax/#oql-operators).

Identifiers are used for module, entity, attribute, association, and alias names and parts of names in paths. Identifiers are only allowed to contain latin characters (`a-Z`), underscores (`_`) and numbers (`0-9`). Numbers can not be used as for the first character of an identifier. Identifiers can be wrapped in double quotes `" "` to allow special characters `.`, `/`, and `@`.

Multiple identifiers can be composed into a path, separated by special characters `.` and `/`. The `.` special character can be used to indicate the module and entity in the form `Module.Entity`. The `/` special character can be used to indicate the attribute of an entity in the form `Module.Entity/Attribute` and it can be used for separating associations in long paths. Examples of paths can be seen in the [Select from Multiple Tables using JOIN](/refguide/oql-clauses/#join) section of *OQL Clauses*.

### Reserved Words {#reserved-oql-words}

Words with a specific purpose in OQL are reserved. If you use reserved words for entity, variable, or attribute names in an OQL query, they must be wrapped in double quotes `" "`. For example, in the OQL query `SELECT AVG(TotalPrice) FROM Sales."Order" WHERE IsPaid = 1`, `Order` needs to be wrapped in quotes because it is a reserved word, as it can be used to `ORDER BY`.

Expand Down Expand Up @@ -85,5 +93,5 @@ In OQL, `FLOAT` is a reserved word for legacy reasons. Mendix no longer supports
{{% /alert %}}

{{% alert color="info" %}}
In OQL, `DELETE`, `INSERT`, `REPLACE`, `UPDATE`, `UPSERT`, `INTO`, `SET`, `VALUES`, `IGNORE`, `MATCHED`, `DUPLICATE`, `KEY`, `CONFLICT`, `MERGE`, `USING`, `SOURCE`, `TARGET`, and `WITH` are reserved but not yet used.
In OQL, `REPLACE`, `UPSERT`, `SET`, `VALUES`, `IGNORE`, `MATCHED`, `DUPLICATE`, `KEY`, `CONFLICT`, `MERGE`, `USING`, `SOURCE`, `TARGET`, and `WITH` are reserved but not yet used.
{{% /alert %}}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ OQL supports a set of data types that differ slightly from [Mendix data types](/
| `LONG` | Integer/Long | 5 | 64 bit width integer data |
| `STRING` | String | 'my_string' | Textual data |

## Literals
## Literals {#oql-literals}

Literals represent values that are constant and are part of the query itself. The supported literals are detailed below:

Expand Down Expand Up @@ -120,7 +120,7 @@ FROM
Sales.Person
```

## Operators
## Operators {#oql-operators}

Operators perform common operations and, unlike functions, do not put their parameters in parentheses. They take `expression` as input, which can be other operator results, functions, columns and literals.

Expand Down