Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for OQL #8431

Open
wants to merge 70 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
8786adf
Documentation for OQL clauses
dahfjkg Oct 4, 2024
c1c38c6
Move to new OQL section of Domain Model
MarkvanMents Oct 14, 2024
3df814d
Proofread
MarkvanMents Oct 14, 2024
7369d45
Proofread
MarkvanMents Oct 14, 2024
239aebd
Proofread
MarkvanMents Oct 15, 2024
5b87de2
Proofread
MarkvanMents Oct 17, 2024
1dc3853
Resolve review comments
dahfjkg Oct 21, 2024
778804a
Proofread to Subqueries section.
MarkvanMents Oct 21, 2024
7f32144
Update content/en/docs/refguide/modeling/domain-model/oql/oql-clauses.md
dahfjkg Oct 21, 2024
63990a7
Better examples for GROUP BY and HAVING
dahfjkg Oct 21, 2024
f421fa9
Update content/en/docs/refguide/modeling/domain-model/oql/oql-clauses.md
dahfjkg Oct 25, 2024
578850c
Describe OQL v2 behavior changes
dahfjkg Oct 25, 2024
4d41982
review comments
dahfjkg Oct 25, 2024
7915620
More review comments and more OQL v2 changes
dahfjkg Oct 30, 2024
3752329
Spellcheck and Lint
MarkvanMents Nov 5, 2024
9afddc3
Proofread oql/_index
MarkvanMents Nov 5, 2024
04aec8a
Proofread oql-clauses
MarkvanMents Nov 5, 2024
2954bd3
Proofread OQL V2
MarkvanMents Nov 6, 2024
db0ae27
Address review comments
dahfjkg Nov 13, 2024
02ea327
Update content/en/docs/refguide/modeling/domain-model/oql/oql-clauses.md
dahfjkg Nov 13, 2024
a659675
Combine existing content into oql-expressions doc
pijuskri Oct 1, 2024
3272da6
Parameter example improvements
pijuskri Oct 1, 2024
8266592
Aggregate documentation
pijuskri Oct 2, 2024
2c3bcff
Aggregate documentation, examples
pijuskri Oct 3, 2024
b5ed1ff
Correct parameter examples, remove bad examples
pijuskri Oct 10, 2024
99756a5
Move oql-expressions to domain-model/oql
MarkvanMents Oct 16, 2024
0f48af2
Proofread oql-expressions
MarkvanMents Oct 16, 2024
0971e3a
Improve wording, change example order
pijuskri Oct 17, 2024
6b361e0
Add reference tag to aggregates section
pijuskri Oct 21, 2024
ef8215b
Align definition of expressions with oql clauses doc
pijuskri Oct 21, 2024
769e32c
Handle review comments
pijuskri Oct 31, 2024
0156528
Proofread and confirm review changes
MarkvanMents Nov 5, 2024
e4f7605
Combine functions and operators into a single file
pijuskri Oct 4, 2024
a1a5b6b
Operator structure, Plus, Minus
pijuskri Oct 7, 2024
a75a123
Binary operator examples, null handling, precedence, string coercion
pijuskri Oct 10, 2024
dcddfa0
Complete other binary operators
pijuskri Oct 11, 2024
e462d7c
Add literals, update COALESCE
pijuskri Oct 15, 2024
90f6118
Add section on system variables
pijuskri Oct 21, 2024
fdbeec6
Add function examples
pijuskri Oct 21, 2024
687d47d
Add range, cast examples
pijuskri Oct 22, 2024
f27592b
Move file to correct location
pijuskri Oct 22, 2024
9c2a09f
Handle review comments
pijuskri Oct 30, 2024
26f4c0c
Spelling and Markdown Review
MarkvanMents Nov 11, 2024
5921b2e
Proofread to 5.4
MarkvanMents Nov 11, 2024
32659c5
Proofread to COALESCE
MarkvanMents Nov 11, 2024
bb45d27
Finish Proofread of oql-expression-syntax
MarkvanMents Nov 12, 2024
5d45760
Address review comments for Expressions Syntax
dahfjkg Nov 13, 2024
981a82e
Address more review comments for Expressions Syntax
dahfjkg Nov 13, 2024
a43dfd1
Document data type validations of expressions in OQL v2
dahfjkg Nov 13, 2024
9c30053
Add links to OQL v2 validations to corresponding functions
dahfjkg Nov 13, 2024
dcb1cea
Correct examples with missing attribute aliases
pijuskri Nov 19, 2024
0a4d137
Add oql UNION clause documentation section
pijuskri Nov 20, 2024
4e2a5ea
Improve oql-v2 docs on alias requirements
pijuskri Nov 21, 2024
841634a
Typo
MarkvanMents Nov 26, 2024
689cf90
Merge branch 'development' into pr/dahfjkg/8431
MarkvanMents Nov 26, 2024
3dc9a9c
Merge branch 'dat/oql-clauses' of https://github.com/dahfjkg/docs int…
MarkvanMents Nov 26, 2024
eb6cb7c
Proofread
MarkvanMents Nov 26, 2024
f692c0e
Add example about UNION of associations
pijuskri Nov 26, 2024
d542cc6
Delete old OQL Clauses
MarkvanMents Nov 27, 2024
34bac48
Remove old OQL Expressions documentation
MarkvanMents Nov 27, 2024
e2acf96
rename data-sets document
MarkvanMents Nov 27, 2024
d74afff
Move Datasets into Data/Entities section
MarkvanMents Nov 27, 2024
6181931
Rename Domain Model section to Data
MarkvanMents Nov 27, 2024
a118e63
Move OQL in navigation.
MarkvanMents Nov 27, 2024
09f2483
Reorganize reserved words
MarkvanMents Nov 27, 2024
0d8ccec
Proofread
MarkvanMents Nov 27, 2024
fa52d8d
Mention that FLOAT is not to be used in OQL
dahfjkg Dec 5, 2024
833492b
More details on system variables in OQL
dahfjkg Dec 18, 2024
7200ba2
Change link to setting that enables OQL v2
dahfjkg Dec 18, 2024
edeaf73
Add more information on tokens in OQL
dahfjkg Dec 24, 2024
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
99 changes: 99 additions & 0 deletions content/en/docs/refguide/modeling/domain-model/oql/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
title: "OQL (New Landing Page)"
url: /refguide/oql-new/
weight: 10
---

## Introduction

The Mendix Object Query Language (OQL) is a relational query language inspired by [SQL](https://en.wikipedia.org/wiki/Sql). The major advantage of OQL is that it uses Mendix entity and association names instead of actual database table names. That way, it is possible to create queries that use names from the data model of your Mendix app without thinking of how that data model is represented in the database.

In addition, OQL can use predefined relations (associations) to easily join objects without having to calculate which columns should be coupled. Despite these differences, many SQL keywords also work in OQL.

These are some examples of OQL queries:

* `SELECT LastName FROM Sales.Customer` – retrieves the names of all customers
* `SELECT FirstName FROM Sales.Customer WHERE LastName = 'Jansen'` – retrieves the first name of all customers with name "Jansen"
* `SELECT SUM(TotalAmount) FROM Sales."Order" WHERE IsPaid = true` – retrieves the sum of the total prices of all paid orders (`Order` needs to be wrapped in quotes, see the [Reserved Words](#reserved-oql-words) section below)
MarkvanMents marked this conversation as resolved.
Show resolved Hide resolved

{{% alert color="info" %}}
OQL queries do not take security into account out-of-the-box. This means that you can use OQL to manually define custom security expressions. In some cases, handling security yourself using OQL—instead of using the out-of-the-box security of XPath—may result in faster queries.
{{% /alert %}}

Try your OQL example online with the [OQL Playground](https://service.mendixcloud.com/p/OQL) demo app.

## 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 for `ORDER BY`.

Here is a list of all OQL reserved words:
dahfjkg marked this conversation as resolved.
Show resolved Hide resolved

* `ALL`
* `AND`
* `AS`
* `ASC`
* `AVG`
* `BOOLEAN`
* `BY`
* `CASE`
* `CAST`
* `COALESCE`
* `COUNT`
* `DATEDIFF`
* `DATEPART`
* `DATETIME`
* `DAY`
* `DAYOFYEAR`
* `DECIMAL`
* `DESC`
* `DISTINCT`
* `ELSE`
* `END`
* `EXISTS`
* `FALSE`
* `FLOAT`
* `FROM`
* `FULL`
* `GROUP`
* `HAVING`
* `HOUR`
* `IN`
* `INNER`
* `INTEGER`
* `IS`
* `JOIN`
* `LEFT`
* `LENGTH`
* `LIKE`
* `LIMIT`
* `LONG`
* `MAX`
* `MILLISECOND`
* `MIN`
* `MINUTE`
* `MONTH`
* `NEXTVALUE`
* `NOT`
* `NULL`
* `OFFSET`
* `ON`
* `OR`
* `ORDER`
* `OUTER`
* `QUARTER`
* `RANGEBEGIN`
* `RANGEEND`
* `RIGHT`
* `ROUND`
* `SECOND`
* `SELECT`
* `STRING`
* `SUM`
* `THEN`
* `TRUE`
* `UNION`
* `WEEK`
* `WEEKDAY`
* `WHEN`
* `WHERE`
* `YEAR`
Loading