---
title: "Select Statement"
description: "A SQL select statement retrieves data from one or multiple data containers."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/query-statement/select-statement
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/query-statement/select-statement
updated: 2026-11-05T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## selectStatement
A SQL select statement retrieves data from one or multiple data containers. A select statement can be composed of multiple data sets retrieved from many platforms, combined by set operators such as 'union'.

Often the performance of cloud platforms is less than traditional database platforms. With the 'limit' clause a limited number of rows can be retrieved quickly from a table or view after applying sorting as specified by the possibly present 'order by'. An alternative for a 'limit' clause is to use the 'top' clause.

Each statement in the SQL batch will be executed consecutively. Execution will be stopped when an error occurs during execution of a statement.

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    selectStatement_start((START))
    selectStatement_start --> selectStatement_0_0[uniqueSelectStatement]
    selectStatement_0_0 --> selectStatement_0_1[setOperatorSelectStatement]
    selectStatement_0_1 --> selectStatement_0_2[orderBy]
    selectStatement_0_2 --> selectStatement_0_3[limitClause]
    selectStatement_0_3 --> selectStatement_0_4[forClause]
    selectStatement_0_4 --> selectStatement_end((END))
```

## setOperatorSelectStatement

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    setOperatorSelectStatement_start((START))
    setOperatorSelectStatement_start --> setOperatorSelectStatement_0_0[UNION]:::quoted
    setOperatorSelectStatement_0_0 --> setOperatorSelectStatement_0_1[ALL]:::quoted
    setOperatorSelectStatement_0_1 --> setOperatorSelectStatement_0_2[DISTINCT]:::quoted
    setOperatorSelectStatement_0_2 --> setOperatorSelectStatement_0_3[ON]:::quoted
    setOperatorSelectStatement_0_3 --> setOperatorSelectStatement_0_4[columnList]
    setOperatorSelectStatement_0_4 --> setOperatorSelectStatement_0_5[MINUS_C]:::quoted
    setOperatorSelectStatement_0_4 --> setOperatorSelectStatement_0_5a[EXCEPT]:::quoted
    setOperatorSelectStatement_0_5 --> setOperatorSelectStatement_0_6[INTERSECT]:::quoted
    setOperatorSelectStatement_0_5a --> setOperatorSelectStatement_0_6
    setOperatorSelectStatement_0_6 --> setOperatorSelectStatement_0_7[uniqueSelectStatement]
    setOperatorSelectStatement_0_7 --> setOperatorSelectStatement_end((END))
```

## Purpose

SQL is based upon a solid mathematical foundation named 'set theory' with some exceptions. The set operators of Invantive UniversalSQL enable you to combine sets of data sets such as merging two sets of data. Please note that SQL actually uses 'bags', which opposed to 'sets', allow duplicates. To change bags of data into sets, either use 'distinct' or the 'union' set operator without 'all'. In general, the extensive use of 'distinct' signals bad database design.

The 'union' set operator returns the union of the data on the left and right side of the union while removing duplicate rows. The 'union all' set operator returns the union of the data on the left and right side of the union without removing duplicate rows. The 'minus' set operator returns all rows from the left side which do not occur in the right side. The 'intersect' set operator returns all rows that occur both in the left and right side.

The 'except' set operator, the name the SQL standard uses, is the same as 'minus': both return each remaining row once. An optional 'distinct' after 'union', 'except', 'minus' or 'intersect' changes nothing, since these already remove duplicate rows. 'except' and the optional 'distinct' are available from release 28.0.

The 'intersect' set operator binds tighter than the other set operators, as in the SQL standard: `a union b intersect c` is `a union (b intersect c)`. Otherwise the set operators are applied from left to right: `a union c minus b` is `(a union c) minus b`. Up to and including release 27.0.79, all set operators were applied from left to right, and a chain of 'intersect' set operators could return too many rows.

Before 'union' and 'intersect' compare two rows, the values of each column are converted to the data type of that column in the result. So an integer `1` on one side and a double `1` on the other side are one row for 'union' and a row in common for 'intersect'. Up to and including release 27.0, a 'union' of one column returned these values as two rows, and 'intersect' found no row in common. Also up to and including release 27.0, a text value which contained the internal separator that joined the columns could make two different rows of two or more columns count as the same row, in 'union' and 'intersect' as well as in a pivot and a `synchronize`.

The 'union' set operator has an extension to facilitate sieving overlapping data sets of decreasing quality using 'distinct on'. The 'union distinct on' set operator returns the union of the data sets listed, but only the first match on the column list is returned. The first match is defined as a fallthrough from left to right. In general, the preferred source of a set of data is listed first, followed by one or multiple 'union distinct on' set operators, each with a data set of less preference.

## uniqueSelectStatement

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    uniqueSelectStatement_start((START))
    uniqueSelectStatement_start --> uniqueSelectStatement_0_0[SELECT]:::quoted
    uniqueSelectStatement_0_0 --> uniqueSelectStatement_0_1[<a href="https://documentation.invantive.com/Invantive UniversalSQL/Execution Hints/Execution Hints" class="internal-link">executionHints</a>]
    uniqueSelectStatement_0_1 --> uniqueSelectStatement_0_2[DISTINCT]
    uniqueSelectStatement_0_1 --> uniqueSelectStatement_0_2a[ALL]
    uniqueSelectStatement_0_2 --> uniqueSelectStatement_0_3[topClause]
    uniqueSelectStatement_0_2a --> uniqueSelectStatement_0_3
    uniqueSelectStatement_0_3 --> uniqueSelectStatement_0_4[selectList]
    uniqueSelectStatement_0_4 --> uniqueSelectStatement_0_5[INTO]:::quoted
    uniqueSelectStatement_0_5 --> uniqueSelectStatement_0_6[pSqlVariableList]
    uniqueSelectStatement_0_6 --> uniqueSelectStatement_0_7[FROM]:::quoted
    uniqueSelectStatement_0_7 --> uniqueSelectStatement_0_8[dataSource]
    uniqueSelectStatement_0_8 --> uniqueSelectStatement_0_9[joinStatements]
    uniqueSelectStatement_0_9 --> uniqueSelectStatement_0_10[whereClause]
    uniqueSelectStatement_0_10 --> uniqueSelectStatement_0_11[groupBy]
    uniqueSelectStatement_0_11 --> uniqueSelectStatement_0_12[havingClause]
    uniqueSelectStatement_0_12 --> uniqueSelectStatement_end((END))
```

## Purpose

Retrieves a data set from one or more data containers.

With `distinct`, every row occurs once in the result. With `all`, the default, duplicate rows are kept, as without either word: `select all x from t` is `select x from t`. `all` is accepted from release 28.0.

## dataSource
One of:

- [tableOrFunctionSpec]]
- [[embeddedSelect]]
- [[XML Table (xmlTable)]]
- [[CSV Table (csvTableSpec)]]
- [[JSON and NDJSON Table (jsonTableSpec)]]
- [[Excel Table (excelTableSpec)]]
- [[HTML Table (htmlTable)]]
- [[String Split (stringSplitSpec)]]
- [[Internet Table (internetTableSpec)]]
- [[#joinedTableInParentheses]]

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    dataSource_start((START))
    dataSource_start --> dataSource_0_0[tableOrFunctionSpecWithRotator]
    dataSource_0_0 --> dataSource_0_1[aliased]
    dataSource_start --> dataSource_0_0a[embeddedSelect]
    dataSource_0_0a --> dataSource_0_1
    dataSource_start --> dataSource_0_0b[xmlTableSpec]
    dataSource_0_0b --> dataSource_0_1
    dataSource_start --> dataSource_0_0c[csvTableSpec]
    dataSource_0_0c --> dataSource_0_1
    dataSource_start --> dataSource_0_0d[jsonTableSpec]
    dataSource_0_0d --> dataSource_0_1
    dataSource_start --> dataSource_0_0e[ndjsonTableSpec]
    dataSource_0_0e --> dataSource_0_1
    dataSource_start --> dataSource_0_0f[excelTableSpec]
    dataSource_0_0f --> dataSource_0_1
    dataSource_start --> dataSource_0_0g[htmlTableSpec]
    dataSource_0_0g --> dataSource_0_1
    dataSource_start --> dataSource_0_0h[stringSplitSpec]
    dataSource_0_0h --> dataSource_0_1
    dataSource_start --> dataSource_0_0i[ngramTableSpec]
    dataSource_0_0i --> dataSource_0_1
    dataSource_start --> dataSource_0_0j[internetTableSpec]
    dataSource_0_0j --> dataSource_0_1
    dataSource_start --> dataSource_0_0k[pipelinedTableFunctionSpec]
    dataSource_0_0k --> dataSource_0_1
    dataSource_start --> dataSource_0_0l[valuesTableSpec]
    dataSource_0_0l --> dataSource_0_1
    dataSource_start --> dataSource_0_0m[joinedTableInParentheses]
    dataSource_0_0m --> dataSource_0_1
    dataSource_0_1 --> dataSource_0_2[valuesColumnAliases]
    dataSource_0_2 --> dataSource_end((END))
```

## Purpose

A data source can be a table, a table with parameters or a nested select (an 'inline view'). Also, a data source can be a binary or text being interpreted as XML, CSV, JSON or binary Excel Open XML format.

From release 28.0 the data sources of a `from` clause can also be separated by commas, as a table reference list of the SQL standard: `from a, b` is the cross join of `a` and `b`, and a condition in the `where` clause joins them, as in `select a.id, b.amount from a, b where a.id = b.id`. A comma binds looser than a join. An inner join and a left outer join after a comma answer the same either way; a right or full outer join after a comma is refused, since the joins are evaluated from left to right. Write the tables before the comma with `cross join` in that case.

From release 28.0 a joined table can be put in parentheses: `from (a cross join b) left outer join c on c.id = a.id`. The tables inside keep their own aliases, and the parentheses have no alias of their own. A joined table in parentheses is taken first in the `from` clause, and after a comma or a `cross join` when it holds only inner, cross and left outer joins. Elsewhere, select it in an inline view.

Up to release 28.0, the words `left`, `right`, `full`, `cross` and `outer` directly after a table without an alias were taken as the alias of that table: `from t left join u on u.id = t.id` was answered as an inner join, so the rows of `t` without a partner were missing. Releases 27.0 and 28.0 take them as the start of the join. To use such a word as an alias, write `as` before it.

## joinedTableInParentheses
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    joinedTableInParentheses_start((START))
    joinedTableInParentheses_start --> joinedTableInParentheses_0_0["("]:::quoted
    joinedTableInParentheses_0_0 --> joinedTableInParentheses_0_1[dataSource]
    joinedTableInParentheses_0_1 --> joinedTableInParentheses_0_2[pivotClause]
    joinedTableInParentheses_0_2 --> joinedTableInParentheses_0_3[joinStatements]
    joinedTableInParentheses_0_3 --> joinedTableInParentheses_0_4[")"]:::quoted
    joinedTableInParentheses_0_4 --> joinedTableInParentheses_end((END))
```

## Purpose
A joined table in parentheses, such as `(a cross join b)` or `(a join b on b.id = a.id)`, available from release 28.0. It takes no alias of its own; see [[#dataSource]] for where it can be used.

## topClause

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    topClause_start((START))
    topClause_start --> topClause_0_0[TOP]:::quoted
    topClause_0_0 --> topClause_0_1[numericConstant]
    topClause_0_1 --> topClause_end((END))
```

## Purpose

With the 'top' clause a limited number of rows can be retrieved quickly from a table or view after applying sorting as specified by the possibly present 'order by'.

## limitClause

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    limitClause_start((START))
    limitClause_start --> limitClause_0_0[LIMIT]:::quoted
    limitClause_0_0 --> limitClause_0_1[numericConstant]
    limitClause_0_1 --> limitClause_end((END))
```

## Purpose

With the 'limit' clause a limited number of rows can be retrieved quickly from a table or view after applying sorting as specified by the possibly present 'order by'.

## numberedOrNamedExpressionList

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    numberedOrNamedExpressionList_start((START))
    numberedOrNamedExpressionList_start --> numberedOrNamedExpressionList_0_0[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    numberedOrNamedExpressionList_0_0 --> numberedOrNamedExpressionList_0_1[","]:::quoted
    numberedOrNamedExpressionList_0_1 --> numberedOrNamedExpressionList_0_2[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    numberedOrNamedExpressionList_0_2 --> numberedOrNamedExpressionList_0_3[namedExpression]
    numberedOrNamedExpressionList_0_3 --> numberedOrNamedExpressionList_0_4[","]:::quoted
    numberedOrNamedExpressionList_0_4 --> numberedOrNamedExpressionList_0_5[namedExpression]
    numberedOrNamedExpressionList_0_5 --> numberedOrNamedExpressionList_end((END))
```

## expressionList

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    expressionList_start((START))
    expressionList_start --> expressionList_0_0[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    expressionList_0_0 --> expressionList_0_1[","]:::quoted
    expressionList_0_1 --> expressionList_0_2[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    expressionList_0_2 --> expressionList_end((END))
```

## Purpose

An ordered comma-separated list of value expressions.

## namedExpressionList

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    namedExpressionList_start((START))
    namedExpressionList_start --> namedExpressionList_0_0[namedExpression]
    namedExpressionList_0_0 --> namedExpressionList_0_1[","]:::quoted
    namedExpressionList_0_1 --> namedExpressionList_0_2[namedExpression]
    namedExpressionList_0_2 --> namedExpressionList_end((END))
```

## Purpose

An unordered list of value expressions, identified by the parameter name.

## namedExpression

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    namedExpression_start((START))
    namedExpression_start --> namedExpression_0_0[<a href="Invantive UniversalSQL/General/Identifiers" class="internal-link">identifier</a>]
    namedExpression_0_0 --> namedExpression_0_1[ASSOCIATION_OPERATOR]:::quoted
    namedExpression_0_1 --> namedExpression_0_2[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    namedExpression_0_2 --> namedExpression_end((END))
```

## Purpose

A value expression, identified by the parameter name, the association operator '=>' and the value expression.

## distributedAliasDirective

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    distributedAliasDirective_start((START))
    distributedAliasDirective_start --> distributedAliasDirective_0_0["@"]:::quoted
    distributedAliasDirective_0_0 --> distributedAliasDirective_0_1[dataContainerAlias]
    distributedAliasDirective_0_1 --> distributedAliasDirective_end((END))
```

## Purpose

The distributed alias after the at-sign specifies a specific data source to be used, such as `ExactOnlineREST..journals@eolbe` specifying the use of Exact Online Belgium when `eolbe` is associated by the database definitions in `settings.xml` with Exact Online Belgium.

A number of special so-called 'service providers' are always present, such as `DataDictionary` for use by an alias.

## dataContainerAlias

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> dataContainerAlias
    dataContainerAlias -->| | exprNode["<a href="Invantive UniversalSQL/General/Identifiers" class="internal-link">identifier</a>"]
    exprNode["<a href="Invantive UniversalSQL/General/Identifiers" class="internal-link">identifier</a>"] --> End((END))
```

## Purpose

When multiple data containers have been defined in `settings.xml` for a database, each one is assigned an alias. An alias typically takes the form of a limited number of characters. The presence of an alias allows Invantive UniversalSQL to precisely determine to what data container forward a request for data.

## passingSourceOrPathExpression

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    passingSourceOrPathExpression_start((START))
    passingSourceOrPathExpression_start --> passingSourceOrPathExpression_0_0[PASSING]
    passingSourceOrPathExpression_0_0 --> passingSourceOrPathExpression_0_1[FILE]
    passingSourceOrPathExpression_0_1 --> passingSourceOrPathExpression_0_2[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    passingSourceOrPathExpression_0_2 --> passingSourceOrPathExpression_end((END))
```

## Purpose

The passing option specifies the source of the contents to be interpreted. The contents can be specified as the outcome of an expression such as from a previous read_file() table function, a URL downloaded using httpget() or a string concatenation. The contents can also be specified as to be taken from a specific file identified by it's file name and path as an expression.

## groupBy

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    groupBy_start((START))
    groupBy_start --> groupBy_0_0["GROUP BY"]:::quoted
    groupBy_0_0 --> groupBy_0_2[columnList]
    groupBy_0_2 --> groupBy_end((END))
```

## Purpose

Grouping of multiple rows into groups is specified by the groupBy. A group will be introduced for each distinct combination of column values for the columns listed. The values of grouped columns can be used in the select clause. Columns not being grouped upon can only be used within the context of a group function listed as 'aggregateFunction'.

## havingClause
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    havingClause_start((START))
    havingClause_start --> havingClause_0_0[HAVING]:::quoted
    havingClause_0_0 --> havingClause_0_1[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    havingClause_0_1 --> havingClause_end((END))
```

## Purpose
The having-clause keeps the groups for which its boolean condition is true, as the where-clause keeps rows. The condition can use group functions, also without a group by: the whole set is then one group. Available from release 28.0; see [[Grouping#Filtering Groups with Having]].

## orderBy

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    orderBy_start((START))
    orderBy_start --> orderBy_0_0["ORDER BY"]:::quoted
    orderBy_0_0 --> orderBy_0_2[sortedColumnList]
    orderBy_0_2 --> orderBy_end((END))
```

## Purpose

Sort the rows returned as specified by the list of sort terms. Values are either sorted ascending (the default) or descending. Null values come first when sorting ascending and last when sorting descending.

Texts are sorted by the code of each character (ordinal), the same on every computer whatever its language settings: capitals come before lower case letters and letters with an accent come after `z`, so `'B'` comes before `'a'` and `'z'` before `'é'`. The same order applies to `limit`, `min`, `max`, `listagg`, `between` and the comparison of texts with `<` and `>`. Up to release 27.0 a sort used the language settings of the computer, which put `'a'` before `'B'`; from release 28.0 onward the sort is ordinal. Use `lower(...)` or `upper(...)` in the sort term to sort without regard to case.

A sort term is one of:
- the name of a column or the alias of a column in the select list;
- the name of a column of the tables in the `from` clause which is not in the select list;
- a position in the select list, such as `2` for the second column, counting the columns of `*` after expansion;
- an expression such as `price * quantity` or `lower(name)`, also when it is not in the select list;
- a correlated subquery.

A position must be a whole number from 1 up to the number of columns; a position beyond the last column raises `itgensql911`, and other constants such as `'a'` or `1.5` raise `itgensql910`. An alias of the select list is only recognised as a sort term on its own, not inside an expression.

An expression which is not in the select list is not allowed in some cases. Add the expression to the select list or sort on its position instead:
- with `union`, `intersect` or `minus`, only a column name or a position of the result is allowed (`itgensql912`);
- with `select distinct`, the expression must be in the select list (`itgensql913`);
- with `group by` or an aggregate in the select list, the expression must be in the select list (`itgensql914`);
- with `top`, the expression must be in the select list (`itgensql915`); `limit` has no such restriction.

The following example sorts on the second column, largest amount first, and then on the first column:
```sql
select rge.value id
,      mod(rge.value * 7, 10) amount
from   range@datadictionary(5) rge
order
by     2 desc
,      1

id | amount
-- | ------
 4 |      8
 1 |      7
 5 |      5
 2 |      4
 3 |      1
```

The following example sorts on an expression which is not in the select list:
```sql
select rge.value id
from   range@datadictionary(5) rge
order
by     mod(rge.value * 7, 10)

id
--
 3
 2
 5
 1
 4
```

The following example shows the ordinal order of texts: capitals come before lower case letters:
```sql
select fruit.name
from   ( select 'banana' name from dual@datadictionary
         union all
         select 'Cherry' name from dual@datadictionary
         union all
         select 'apple' name from dual@datadictionary
         union all
         select 'Apple' name from dual@datadictionary
       ) fruit
order
by     fruit.name

name
------
Apple
Cherry
apple
banana
```

The following example sorts the same texts without regard to case, and puts the capital first where two texts only differ in case:
```sql
select fruit.name
from   ( select 'banana' name from dual@datadictionary
         union all
         select 'Cherry' name from dual@datadictionary
         union all
         select 'apple' name from dual@datadictionary
         union all
         select 'Apple' name from dual@datadictionary
       ) fruit
order
by     lower(fruit.name)
,      fruit.name

name
------
Apple
apple
banana
Cherry
```

## pivotClause

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    pivotClause_start((START))
    pivotClause_start --> pivotClause_0_0["PIVOT"]:::quoted
    pivotClause_0_0 --> pivotClause_0_1["("]:::quoted
    pivotClause_0_1 --> pivotClause_0_2[aggregateFunction]
    pivotClause_0_2 --> pivotClause_0_3["FOR"]:::quoted
    pivotClause_0_3 --> pivotClause_0_4[column]
    pivotClause_0_4 --> pivotClause_0_5["IN"]:::quoted
    pivotClause_0_5 --> pivotClause_0_6["("]:::quoted
    pivotClause_0_6 --> pivotClause_0_7[columnNoAliasList]
    pivotClause_0_7 --> pivotClause_0_8[")"]:::quoted
    pivotClause_0_8 --> pivotClause_0_9[")"]:::quoted
    pivotClause_0_9 --> pivotClause_0_10[aliased]
    pivotClause_0_10 --> pivotClause_end((END))
```

## sortDirection

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> sortDirection
    sortDirection -->| | ASC["ASC"]:::quoted
    ASC --> End((END))
    sortDirection -->| | DESC["DESC"]:::quoted
    DESC --> End((END))
```

## Purpose

A sort direction can be either 'asc' for 'ascending' (the default) or 'desc' for 'descending'.

## columnList

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    columnList_start((START))
    columnList_start --> columnList_0_0[column]
    columnList_0_0 --> columnList_0_1[","]
    columnList_0_1 --> columnList_0_2[column]
    columnList_0_2 --> columnList_end((END))
```

## Purpose

A comma-separated list of columns.

## sortedColumnList

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    sortedColumnList_start((START))
    sortedColumnList_start --> sortedColumnList_0_0[sortedColumn]
    sortedColumnList_0_0 --> sortedColumnList_0_1[","]:::quoted
    sortedColumnList_0_1 --> sortedColumnList_0_2[sortedColumn]
    sortedColumnList_0_2 --> sortedColumnList_end((END))
```

## Purpose

An ordered comma-separated list of column values to sort upon.

## sortedColumn

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    sortedColumn_start((START))
    sortedColumn_start --> sortedColumn_0_0[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    sortedColumn_0_0 --> sortedColumn_0_1[sortDirection]
    sortedColumn_0_1 --> sortedColumn_end((END))
```

## Purpose

A value to sort upon: a column, a position in the select list or an expression, optionally followed by a sort direction.

## column

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    column_start((START))
    column_start --> column_0_0[<a href="Invantive UniversalSQL/General/Identifiers" class="internal-link">identifier</a>]
    column_0_0 --> column_0_1["."]:::quoted
    column_0_1 --> column_0_2[<a href="Invantive UniversalSQL/General/Identifiers" class="internal-link">identifier</a>]
    column_0_2 --> column_end((END))
```

## Purpose

A column is identified by an identifier, possibly prefixed by the name of the table or the alias of the table from which the column is to be taken.

## columnNoAliasList

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    columnNoAliasList_start((START))
    columnNoAliasList_start --> columnNoAliasList_0_0[columnNoAlias]
    columnNoAliasList_0_0 --> columnNoAliasList_0_1[","]:::quoted
    columnNoAliasList_0_1 --> columnNoAliasList_0_2[columnNoAlias]
    columnNoAliasList_0_2 --> columnNoAliasList_end((END))
```

## columnNoAlias

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> columnNoAlias
    columnNoAlias -->| | exprNode["<a href="Invantive UniversalSQL/General/Identifiers" class="internal-link">identifier</a>"]
    exprNode["<a href="Invantive UniversalSQL/General/Identifiers" class="internal-link">identifier</a>"] --> End((END))
```

## whereClause

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    whereClause_start((START))
    whereClause_start --> whereClause_0_0[WHERE]:::quoted
    whereClause_0_0 --> whereClause_0_1[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    whereClause_0_1 --> whereClause_end((END))
```

## Purpose

The where-clause restricts the number of rows in a result set by applying one or more boolean condiditions which rows must satisfy.

## joinStatements

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> joinStatements
    joinStatements -->| | joinStatement
    joinStatement --> End((END))
```

## Purpose

A list of join statements.

## joinStatement

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    joinStatement_start((START))
    joinStatement_start --> joinStatement_0_0[joinCategory]
    joinStatement_0_0 --> joinStatement_0_1[JOIN]:::quoted
    joinStatement_0_1 --> joinStatement_0_2[dataSource]
    joinStatement_0_2 --> joinStatement_0_3[joinConditions]
    joinStatement_0_3 --> joinStatement_0_4[pivotClause]
    joinStatement_0_4 --> joinStatement_end((END))
    joinStatement_start --> joinStatement_1_0[","]:::quoted
    joinStatement_1_0 --> joinStatement_1_1[dataSource]
    joinStatement_1_1 --> joinStatement_1_2[pivotClause]
    joinStatement_1_2 --> joinStatement_end
```

## Purpose

A join statement combines two result sets. Only combinations of rows taken from both result sets are returned when they meet the join conditions.

From release 28.0 a comma followed by a data source is a cross join, as in a table reference list of the SQL standard; see [[#dataSource]].

## joinCategory

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    joinCategory_start((START))
    joinCategory_start --> joinCategory_0_0[INNER]
    joinCategory_0_0 --> joinCategory_0_1[joinSubCategory]
    joinCategory_0_1 --> joinCategory_0_2[OUTER]
    joinCategory_0_2 --> joinCategory_0_3[CROSS]
    joinCategory_0_3 --> joinCategory_end((END))
```

## Purpose

The join category specifies what combinations of rows are considered. The following variants can be used:

- inner join, as indicated by 'join' or 'inner join': an inner join returns all combinations of rows from both result sets that meet the join conditions.
- left outer, as indicated by 'left outer join': a left outer join returns the same rows as an inner join, extended by one row for each row in the left result set having no matching rows in the right result set. Each column that originates from the right result set is assigned a null value.
- right outer, as indicated by 'right outer join': a right outer join returns the same rows as an inner join, extended by one row for each row in the right result set having no matching rows in the left result set. Each column that originates from the left result set is assigned a null value.
- full outer, as indicated by 'full outer join': a full outer join returns the same rows as an inner join, extended by one row for each row in the right result set having no matching rows in the left result set. Each column that originates from the left result set is assigned a null value. The results are also extended by one row for each row in the left result set having no matching rows in the right result set. Each column that originates from the right result set is assigned a null value. Up to release 28.0, a full outer join with a table function or an inline view over one on the right side was answered as a left outer join, so the rows of the right side without a partner were missing. Releases 27.0 and 28.0 answer it as a full outer join, unless the arguments of the table function read a column of the left side; such a join is refused with itgenjir004, as the SQL standard does. Use a left outer join for it instead.
- cross join, as indicated by 'cross join': a cross join returns a Cartesian product of the rows from both result sets. A 'Cartesian product' is a term from set theory, which indicates that all combinations are returned. The SQL standard does not allow join conditions after 'cross join'. Invantive UniversalSQL accepts an `on` there and then returns the same rows as an inner join with those conditions. Up to and including release 27.0, a cross join left out the right result set: `select count(*) from t a cross join t b` returned the number of rows of `t` instead of its square, and a reference to the alias of the right side could fail with `itgensql035`.

## joinSubCategory

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> joinSubCategory
    joinSubCategory -->| | LEFT:::quoted
    LEFT --> End((END))
    joinSubCategory -->| | RIGHT:::quoted
    RIGHT --> End((END))
    joinSubCategory -->| | FULL:::quoted
    FULL --> End((END))
```

## Purpose

The join sub-category refines the join category. Please see 'joinCategory' for an explanation.

## joinConditions

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    joinConditions_start((START))
    joinConditions_start --> joinConditions_0_0[ON]
    joinConditions_0_0 --> joinConditions_0_1[<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>]
    joinConditions_0_1 --> joinConditions_end((END))
```

## Purpose

A boolean expression which defines valid combinations of the join.

## selectList

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    selectList_start((START))
    selectList_start --> selectList_0_0[selectPart]
    selectList_0_0 --> selectList_0_1[","]:::quoted
    selectList_0_1 --> selectList_0_2[selectPart]
    selectList_0_2 --> selectList_end((END))
```

## selectPart

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    selectPart_start((START))
    selectPart_start --> selectPart_0_0[part]
    selectPart_0_0 --> selectPart_0_1[aliased]
    selectPart_0_1 --> selectPart_0_2[labeled]
    selectPart_0_2 --> selectPart_end((END))
```

## aliased

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    aliased_start((START))
    aliased_start --> aliased_0_0[AS]:::quoted
    aliased_0_0 --> aliased_0_1[alias]
    aliased_0_1 --> aliased_end((END))
```

## labeled

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    labeled_start((START))
    labeled_start --> labeled_0_0[LABEL]:::quoted
    labeled_0_0 --> labeled_0_1[stringConstant]
    labeled_0_1 --> labeled_end((END))
```

## Purpose

Defines the textual label of an expression. The label may contain resources in the format '{res:resource code}' such as 'My {res:itgen_description}'. Similar to the data type and alias of an expression, the label is maintained across selections. Application of a calculation or a SQL function resets the label to the empty value. User interfaces can choose to display the label when available instead of the column name to provide a more natural interface.

## part

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> part
    part -->| | aggregateFunction
    aggregateFunction --> End((END))
    part -->| | exprNode["<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>"]
    exprNode["<a href="Invantive UniversalSQL/Grammar/Expression" class="internal-link">expression</a>"] --> End((END))
    part -->| | allColumnsSpec
    allColumnsSpec --> End((END))
```

## allColumnsSpec

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    allColumnsSpec_start((START))
    allColumnsSpec_start --> allColumnsSpec_0_0[allColumnsSpecId]
    allColumnsSpec_0_0 --> allColumnsSpec_0_1[allColumnsSpecColumnNamePrefix]
    allColumnsSpec_0_1 --> allColumnsSpec_0_2[allColumnsSpecColumnNamePostfix]
    allColumnsSpec_0_2 --> allColumnsSpec_0_3[allColumnsSpecLabelPrefix]
    allColumnsSpec_0_3 --> allColumnsSpec_0_4[allColumnsSpecLabelPostfix]
    allColumnsSpec_0_4 --> allColumnsSpec_end((END))
```

## Purpose

Selects all columns from an SQL statement or from one or more data sources used. The except clause allows retrieval of all columns except the listed names. The except clause is typically used with wide result sets with possibly varying column lists from which a few pre-defined columns need to be excluded.

More than one name is best written between parentheses, as in `txn.* except (period, ledger_id)`. Without parentheses, the names after the first are also excluded as long as each is a bare column, without alias or label, which the asterisk delivers and which is not excluded already: `txn.* except period, ledger_id` excludes both. The first element which does not meet that, such as an expression or a column of another data source, starts the rest of the select list, as in `fzl.* except id, fte.afkorting`. A column which is already excluded is selected again, so `* except volgorde, volgorde` puts `volgorde` last. A prefix, postfix or label prefix or postfix behind more than one name always needs the parentheses: `txn.* except period, ledger_id prefix with 'x_'` is a syntax error.

Release 27.0 before the fix of forum topic 7006 took only the first name without parentheses and selected every next name a second time, next to the copy the asterisk had already delivered, under a name of its own such as `ledger_id2`.

When the asterisk carries an alias, the names of the except clause are the columns of that alias and of no other data source. A name which another data source also carries is therefore not ambiguous in an except clause and needs no alias of its own. A name which the alias does not carry is reported as a missing column.

## allColumnsSpecId

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    allColumnsSpecId_start((START))
    allColumnsSpecId_start --> allColumnsSpecId_0_0[alias]
    allColumnsSpecId_0_0 --> allColumnsSpecId_0_1["."]:::quoted
    allColumnsSpecId_0_1 --> allColumnsSpecId_0_2["*"]:::quoted
    allColumnsSpecId_0_2 --> allColumnsSpecId_0_3["EXCEPT"]:::quoted
    allColumnsSpecId_0_3 --> allColumnsSpecId_0_4["("]:::quoted
    allColumnsSpecId_0_4 --> allColumnsSpecId_0_5[columnList]
    allColumnsSpecId_0_5 --> allColumnsSpecId_0_6[")"]:::quoted
    allColumnsSpecId_0_6 --> allColumnsSpecId_end((END))
    allColumnsSpecId_0_3 --> allColumnsSpecId_1_0[column]
    allColumnsSpecId_1_0 --> allColumnsSpecId_end
```

## allColumnsSpecColumnNamePrefix

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    allColumnsSpecColumnNamePrefix_start((START))
    allColumnsSpecColumnNamePrefix_start --> allColumnsSpecColumnNamePrefix_0_0[PREFIX]:::quoted
    allColumnsSpecColumnNamePrefix_0_0 --> allColumnsSpecColumnNamePrefix_0_1[WITH]:::quoted
    allColumnsSpecColumnNamePrefix_0_1 --> allColumnsSpecColumnNamePrefix_0_2[stringConstant]
    allColumnsSpecColumnNamePrefix_0_2 --> allColumnsSpecColumnNamePrefix_end((END))
```

## Purpose

Defines the aliases of columns selected by the select all ('') operator as their original alias, prefixed with the specified text. For instance, the select operator changes the alias of the column 'code' with the prefix 'pjt_' into 'pjt_code'.

## allColumnsSpecColumnNamePostfix

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    allColumnsSpecColumnNamePostfix_start((START))
    allColumnsSpecColumnNamePostfix_start --> allColumnsSpecColumnNamePostfix_0_0[POSTFIX]:::quoted
    allColumnsSpecColumnNamePostfix_0_0 --> allColumnsSpecColumnNamePostfix_0_1[WITH]:::quoted
    allColumnsSpecColumnNamePostfix_0_1 --> allColumnsSpecColumnNamePostfix_0_2[stringConstant]
    allColumnsSpecColumnNamePostfix_0_2 --> allColumnsSpecColumnNamePostfix_end((END))
```

## Purpose

Defines the aliases of columns selected by the select all ('') operator as their original alias, postfixed with the specified text. For instance, the select operator changes the alias of the column 'code' with the postfix 'from_table2' into 'code_from_table2'.

## allColumnsSpecLabelPrefix
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    allColumnsSpecLabelPrefix_start((START))
    allColumnsSpecLabelPrefix_start --> allColumnsSpecLabelPrefix_0_0[LABEL]:::quoted
    allColumnsSpecLabelPrefix_0_0 --> allColumnsSpecLabelPrefix_0_1[PREFIX]:::quoted
    allColumnsSpecLabelPrefix_0_1 --> allColumnsSpecLabelPrefix_0_2[WITH]:::quoted
    allColumnsSpecLabelPrefix_0_2 --> allColumnsSpecLabelPrefix_0_3[stringConstant]
    allColumnsSpecLabelPrefix_0_3 --> allColumnsSpecLabelPrefix_end((END))
```

## Purpose

Defines the label of columns selected by the select all ('') operator as their original label, prefixed with the specified text. For instance, the select operator changes the label 'Name' of the column 'name' with the prefix 'Project ' into 'Project Name'.

## allColumnsSpecLabelPostfix

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart TD
    allColumnsSpecLabelPostfix_start((START))
    allColumnsSpecLabelPostfix_start --> allColumnsSpecLabelPostfix_0_0[LABEL]:::quoted
    allColumnsSpecLabelPostfix_0_0 --> allColumnsSpecLabelPostfix_0_1[POSTFIX]:::quoted
    allColumnsSpecLabelPostfix_0_1 --> allColumnsSpecLabelPostfix_0_2[WITH]:::quoted
    allColumnsSpecLabelPostfix_0_2 --> allColumnsSpecLabelPostfix_0_3[stringConstant]
    allColumnsSpecLabelPostfix_0_3 --> allColumnsSpecLabelPostfix_end((END))
```

## Purpose

Defines the label of columns selected by the select all ('') operator as their original label, postfixed with the specified text. For instance, the select operator changes the label 'Name' of the column 'name' with the postfix ' from Table2' into 'Name from Table2'.

## orReplace

```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    orReplace_start((START))
    orReplace_start --> orReplace_0_0[OR]
    orReplace_0_0 --> orReplace_0_1[REPLACE]:::quoted
    orReplace_0_1 --> orReplace_end((END))
```