Skip to content

Commit 9be7a7d

Browse files
committed
Add domain models and review OQL documentation
1 parent 545ea9d commit 9be7a7d

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

content/en/docs/refguide/modeling/domain-model/oql/oql-clauses.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Clauses must be presented in the following order, but can be left out if they ar
3838

3939
The `UNION` clause defies the usual order presented above. It will be presented in a [Union Clause](#oql-union) section at the end.
4040

41+
The domain model used in the various examples is shown below:
42+
43+
{{< figure src="/attachments/refguide/modeling/domain-model/oql/oql-clauses-domain-model.png" >}}
44+
4145
## `SELECT` Clause {#select}
4246

4347
The `SELECT` clause specifies which entity attributes or other specified data must be retrieved. The clause returns all the requested values of objects which match the `SELECT` clause.
@@ -111,15 +115,15 @@ The following query returns all attributes of objects of `Sales.Request` that ar
111115
```
112116
SELECT Sales.Request/*
113117
FROM Sales.Customer
114-
JOIN Sales.Customer/Sales.Customer_Request/Sales.Request
118+
JOIN Sales.Customer/Sales.Request_Customer/Sales.Request
115119
```
116120

117121
The following query is equivalent to the previous one, but it uses table aliases
118122

119123
```
120124
SELECT Req/*
121125
FROM Sales.Customer Cust
122-
JOIN Cust/Sales.Customer_Request/Sales.Request Req
126+
JOIN Cust/Sales.Request_Customer/Sales.Request Req
123127
```
124128

125129
### Selecting Distinct Values with `DISTINCT` {#distinct}
@@ -978,7 +982,7 @@ In the example below `Sales.Customer` object for Jim Elk does not have any assoc
978982
```sql
979983
SELECT LastName
980984
FROM Sales.Customer
981-
ORDER BY Sales.Customer/Sales.Customer_Request/Sales.Request/Number
985+
ORDER BY Sales.Customer/Sales.Request_Customer/Sales.Request/Number
982986
```
983987

984988
| LastName |

content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Operators and functions in OQL use expressions as inputs to perform mathematical
2525

2626
This document details the use and syntax of expressions in an OQL query.
2727

28+
The domain model used in the various examples is shown below:
29+
30+
{{< figure src="/attachments/refguide/modeling/domain-model/oql/oql-expression-syntax-domain-model.png" >}}
31+
2832
## Data Types
2933

3034
OQL supports a set of data types that differ slightly from [Mendix data types](/refguide/data-types/). The supported data types are:
@@ -544,7 +548,7 @@ Where `expression` is an expression of any datatype.
544548
The `IS` operator can be used to filter out rows with values that are NULL. For example:
545549

546550
```sql
547-
SELECT Revenue, Cost FROM Sales.Finance WHERE Revenue IS NOT NULL
551+
SELECT Revenue, Cost FROM Sales.Finances WHERE Revenue IS NOT NULL
548552
```
549553

550554
| Revenue | Cost |
@@ -1141,18 +1145,18 @@ For example, a space delimited list can be converted to one with commas to be us
11411145
SELECT * FROM Sales.Raw
11421146
```
11431147

1144-
| ID | Import |
1148+
| ID | RawImport |
11451149
|----|-------------------|
11461150
| - | "6 D10 machinery" |
11471151
| - | "1 A15 tools" |
11481152

11491153
The text can be converted with `REPLACE` as follows:
11501154

11511155
```sql
1152-
SELECT REPLACE(Import, ' ', ',') FROM Sales.Raw
1156+
SELECT REPLACE(RawImport, ' ', ',') FROM Sales.Raw
11531157
```
11541158

1155-
| Import |
1159+
| RawImport |
11561160
|-------------------|
11571161
| "6,D10,machinery" |
11581162
| "1,A15,tools" |

content/en/docs/refguide/modeling/domain-model/oql/oql-expressions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ An OQL expression is a query building block that returns a value or a list of va
2020

2121
OQL expressions can be used in `WHERE`, `SELECT`, `GROUP BY`, `UNION`, `HAVING`, and `ON` conditions of `JOIN` clauses. For more information, see [OQL clauses](/refguide/oql-clauses/).
2222

23+
The domain model used in the various examples is shown below:
24+
25+
{{< figure src="/attachments/refguide/modeling/domain-model/oql/oql-expressions-domain-model.png" >}}
26+
2327
## Aggregations{#aggregates}
2428

2529
Aggregations are functions that reduce a list of values from a retrieved column (or columns) into a single value. They can be used in the following ways:
@@ -173,7 +177,7 @@ SELECT MAX(Stock) as StockMax FROM Sales.Product
173177
To return the name(s) of the product(s) with the highest stock level you have to use a subquery. The subquery returns the maximum stock number, which is then compared to each product's stock in the `WHERE` clause:
174178

175179
```sql
176-
SELECT HighestStockProductName FROM Sales.Product
180+
SELECT Name AS HighestStockProductName FROM Sales.Product
177181
WHERE Stock = (SELECT MAX(P.Stock) FROM Sales.Product P)
178182
```
179183

45.6 KB
Loading
39.6 KB
Loading
11 KB
Loading

0 commit comments

Comments
 (0)