-
Notifications
You must be signed in to change notification settings - Fork 744
Add domain models and review OQL documentation #9914
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
base: development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo - the other examples used "Finances" |
||
``` | ||
|
||
| Revenue | Cost | | ||
|
@@ -1141,18 +1145,18 @@ For example, a space delimited list can be converted to one with commas to be us | |
SELECT * FROM Sales.Raw | ||
``` | ||
|
||
| ID | Import | | ||
| ID | RawImport | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Import" is an invalid attribute name |
||
|----|-------------------| | ||
| - | "6 D10 machinery" | | ||
| - | "1 A15 tools" | | ||
|
||
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" | | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we want to pick up Name here but report it as "HighestStockProductName" |
||
WHERE Stock = (SELECT MAX(P.Stock) FROM Sales.Product P) | ||
``` | ||
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about this - what is the relationship between Storage and Location? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was back to front naming?