diff --git a/content/en/docs/refguide/modeling/domain-model/oql/oql-clauses.md b/content/en/docs/refguide/modeling/domain-model/oql/oql-clauses.md index 82554d2ff50..7ab8b965150 100644 --- a/content/en/docs/refguide/modeling/domain-model/oql/oql-clauses.md +++ b/content/en/docs/refguide/modeling/domain-model/oql/oql-clauses.md @@ -38,6 +38,10 @@ Clauses must be presented in the following order, but can be left out if they ar The `UNION` clause defies the usual order presented above. It will be presented in a [Union Clause](#oql-union) section at the end. +The domain model used in the various examples is shown below: + +{{< figure src="/attachments/refguide/modeling/domain-model/oql/oql-clauses-domain-model.png" >}} + ## `SELECT` Clause {#select} 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,7 +115,7 @@ The following query returns all attributes of objects of `Sales.Request` that ar ``` SELECT Sales.Request/* FROM Sales.Customer -JOIN Sales.Customer/Sales.Customer_Request/Sales.Request +JOIN Sales.Customer/Sales.Request_Customer/Sales.Request ``` The following query is equivalent to the previous one, but it uses table aliases @@ -119,7 +123,7 @@ The following query is equivalent to the previous one, but it uses table aliases ``` SELECT Req/* FROM Sales.Customer Cust -JOIN Cust/Sales.Customer_Request/Sales.Request Req +JOIN Cust/Sales.Request_Customer/Sales.Request Req ``` ### 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 ```sql SELECT LastName FROM Sales.Customer -ORDER BY Sales.Customer/Sales.Customer_Request/Sales.Request/Number +ORDER BY Sales.Customer/Sales.Request_Customer/Sales.Request/Number ``` | LastName | diff --git a/content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md b/content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md index a6cd859b0e6..a44201d4ad2 100644 --- a/content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md +++ b/content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md @@ -25,6 +25,10 @@ Operators and functions in OQL use expressions as inputs to perform mathematical This document details the use and syntax of expressions in an OQL query. +The domain model used in the various examples is shown below: + +{{< figure src="/attachments/refguide/modeling/domain-model/oql/oql-expression-syntax-domain-model.png" >}} + ## Data Types 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. The `IS` operator can be used to filter out rows with values that are NULL. For example: ```sql - SELECT Revenue, Cost FROM Sales.Finance WHERE Revenue IS NOT NULL + SELECT Revenue, Cost FROM Sales.Finances WHERE Revenue IS NOT NULL ``` | Revenue | Cost | @@ -1141,7 +1145,7 @@ For example, a space delimited list can be converted to one with commas to be us SELECT * FROM Sales.Raw ``` -| ID | Import | +| ID | RawImport | |----|-------------------| | - | "6 D10 machinery" | | - | "1 A15 tools" | @@ -1149,10 +1153,10 @@ SELECT * FROM Sales.Raw The text can be converted with `REPLACE` as follows: ```sql -SELECT REPLACE(Import, ' ', ',') FROM Sales.Raw +SELECT REPLACE(RawImport, ' ', ',') FROM Sales.Raw ``` -| Import | +| RawImport | |-------------------| | "6,D10,machinery" | | "1,A15,tools" | diff --git a/content/en/docs/refguide/modeling/domain-model/oql/oql-expressions.md b/content/en/docs/refguide/modeling/domain-model/oql/oql-expressions.md index dd5aa80c474..b85835631ac 100644 --- a/content/en/docs/refguide/modeling/domain-model/oql/oql-expressions.md +++ b/content/en/docs/refguide/modeling/domain-model/oql/oql-expressions.md @@ -20,6 +20,10 @@ An OQL expression is a query building block that returns a value or a list of va 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/). +The domain model used in the various examples is shown below: + +{{< figure src="/attachments/refguide/modeling/domain-model/oql/oql-expressions-domain-model.png" >}} + ## Aggregations{#aggregates} 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 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: ```sql -SELECT HighestStockProductName FROM Sales.Product +SELECT Name AS HighestStockProductName FROM Sales.Product WHERE Stock = (SELECT MAX(P.Stock) FROM Sales.Product P) ``` diff --git a/static/attachments/refguide/modeling/domain-model/oql/oql-clauses-domain-model.png b/static/attachments/refguide/modeling/domain-model/oql/oql-clauses-domain-model.png new file mode 100644 index 00000000000..de8bb17029a Binary files /dev/null and b/static/attachments/refguide/modeling/domain-model/oql/oql-clauses-domain-model.png differ diff --git a/static/attachments/refguide/modeling/domain-model/oql/oql-expression-syntax-domain-model.png b/static/attachments/refguide/modeling/domain-model/oql/oql-expression-syntax-domain-model.png new file mode 100644 index 00000000000..6901007a8d2 Binary files /dev/null and b/static/attachments/refguide/modeling/domain-model/oql/oql-expression-syntax-domain-model.png differ diff --git a/static/attachments/refguide/modeling/domain-model/oql/oql-expressions-domain-model.png b/static/attachments/refguide/modeling/domain-model/oql/oql-expressions-domain-model.png new file mode 100644 index 00000000000..3cc883040d3 Binary files /dev/null and b/static/attachments/refguide/modeling/domain-model/oql/oql-expressions-domain-model.png differ