InvantiveのドキュメントInvantive Cloudの一部
Invantive サポートフォーラムログイン / 会員登録

Select文

selectStatement

SQLのSELECT文は、1つまたは複数のデータコンテナからデータを取得します。 SELECT文は、多数のプラットフォームから取得した複数のデータセットを、「union」などの集合演算子で組み合わせて構成できます。

一般に、クラウドプラットフォームの性能は、従来のデータベースプラットフォームより劣ることが多いです。 「limit」句を使うと、省略可能な「order by」で指定された並べ替えを適用した後、テーブルまたはビューから限られた行数を素早く取得できます。 「limit」句の代わりに、「top」句を使うこともできます。

SQLバッチ内の各文は、順番に実行されます。 文の実行中にエラーが発生すると、実行は停止します。

%%{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

%%{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))

目的

SQLは、いくつかの例外を除き、「集合論」と呼ばれる確固たる数学的基礎に基づいています。 Invantive UniversalSQLの集合演算子を使うと、2つのデータセットを統合するなど、データセットの集合を組み合わせることができます。 なお、SQLでは実際には「集合」ではなく「バッグ」を使用しており、「バッグ」は「集合」と異なり重複を許容することに注意してください。 データのバッグを集合に変換するには、「distinct」を使うか、「all」を付けない「union」集合演算子を使用します。 一般に、「distinct」を多用することは、データベース設計が不適切であることを示しています。

「union」集合演算子は、重複行を除去しながら、結合の左側と右側のデータの和集合を返します。 「union all」集合演算子は、重複行を除去せずに、結合の左側と右側のデータの和集合を返します。 「minus」集合演算子は、左側のデータのうち右側に存在しない行をすべて返します。 「intersect」集合演算子は、左側と右側の両方に存在する行をすべて返します。

「except」集合演算子は、SQL標準で使われる名称で、「minus」と同じです。どちらも残りの各行を1回ずつ返します。 「union」「except」「minus」「intersect」の後に任意で付ける「distinct」は、これらが既に重複行を除去するため、何も変えません。「except」および任意の「distinct」はリリース28.0から利用できます。

SQL標準に従い、「intersect」集合演算子は他の集合演算子より強く結合します。すなわち、a union b intersect cはa union (b intersect c)と同じです。 それ以外の場合、集合演算子は左から右へ順に適用されます。すなわち、a union c minus bは(a union c) minus bと同じです。 リリース27.0.79まで(これを含む)では、すべての集合演算子は左から右へ適用され、「intersect」集合演算子の連鎖は必要以上に多くの行を返すことがありました。

「union」と「intersect」が2つの行を比較する前に、各列の値は結果におけるその列のデータ型に変換されます。 したがって、一方の側の整数1と、もう一方の側の倍精度浮動小数点数1は、「union」では1行、「intersect」では共通の1行となります。 リリース27.0まで(これを含む)では、1列の「union」はこれらの値を2行として返し、「intersect」は共通の行を見つけませんでした。 同じくリリース27.0まで(これを含む)では、列を結合する内部区切り文字を含むテキスト値により、2つ以上の列の異なる2行が同一の行とみなされることがありました。これは「union」および「intersect」だけでなく、ピボットやsynchronizeでも起こり得ました。

「union」集合演算子には、「distinct on」を使って、品質が低下していく重複データセットをふるいにかけるための拡張機能があります。 「union distinct on」集合演算子は、列挙されたデータセットの和集合を返しますが、列リストで最初に一致した行のみを返します。 最初の一致とは、左から右へのフォールスルーとして定義されます。 一般に、優先するデータソースを先頭に列挙し、その後に1つ以上の「union distinct on」集合演算子を続け、それぞれに優先度の低いデータセットを指定します。

uniqueSelectStatement

%%{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))

目的

1つ以上のデータコンテナからデータセットを取得します。

distinctを指定すると、結果の各行は1回だけ現れます。 all(既定値)を指定すると、どちらの語も付けない場合と同様に重複行は保持されます。select all x from tはselect x from tと同じです。allはリリース28.0から使用できます。

dataSource

次のいずれか:

%%{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))

目的

データソースには、テーブル、パラメータ付きテーブル、またはネストされたSELECT(「インラインビュー」)を指定できます。 また、データソースには、XML、CSV、JSON、またはバイナリExcel Open XML形式として解釈されるバイナリまたはテキストを指定することもできます。

リリース28.0から、from句のデータソースはカンマで区切ることもできます。これはSQL標準のテーブル参照リストと同様で、from a, bはaとbのクロス結合であり、where句の条件によってそれらが結合されます。例: select a.id, b.amount from a, b where a.id = b.id カンマは結合よりも弱く結合します。 カンマの後の内部結合と左外部結合は、どちらの順序でも同じ結果になります。一方、カンマの後の右外部結合または完全外部結合は、結合が左から右へ評価されるため拒否されます。 その場合は、カンマの前のテーブルをcross joinで記述してください。

リリース28.0から、結合テーブルはかっこで囲むことができます: from (a cross join b) left outer join c on c.id = a.id。 内側のテーブルはそれぞれ独自のエイリアスを保持し、かっこ自体にはエイリアスはありません。 かっこで囲んだ結合テーブルは、from句で最初に評価され、カンマの後またはcross joinの後では、内部結合、クロス結合、左外部結合のみを含む場合に評価されます。 それ以外の場所では、インラインビューとして選択してください。

リリース28.0まで、エイリアスのないテーブルの直後にあるleft、right、full、cross、outerという語は、そのテーブルのエイリアスとして扱われていました。例えばfrom t left join u on u.id = t.idは内部結合として応答され、tのパートナーのない行が欠落していました。 リリース27.0と28.0では、これらは結合の開始として扱われます。 そのような語をエイリアスとして使用するには、その前にasを記述してください。

joinedTableInParentheses

%%{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))

目的

かっこで囲んだ結合テーブル(例: (a cross join b)または(a join b on b.id = a.id))は、リリース28.0から利用できます。 かっこで囲んだ結合テーブル自体にはエイリアスを付けられません。使用できる場所については#dataSourceを参照してください。

topClause

%%{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))

目的

「top」句を使うと、省略可能な「order by」で指定された並べ替えを適用した後、テーブルまたはビューから限られた行数を素早く取得できます。

limitClause

%%{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))

目的

「limit」句を使うと、省略可能な「order by」で指定された並べ替えを適用した後、テーブルまたはビューから限られた行数を素早く取得できます。

numberedOrNamedExpressionList

%%{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

%%{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))

目的

値式のカンマ区切りの順序付きリスト。

namedExpressionList

%%{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))

目的

パラメータ名で識別される、順序を持たない値式のリスト。

namedExpression

%%{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))

目的

パラメータ名、関連演算子 '=>'、および値式で識別される値式。

distributedAliasDirective

%%{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))

目的

@記号の後に続く分散エイリアスは、使用する特定のデータソースを指定します。例えば、ExactOnlineREST..journals@eolbeは、settings.xml内のデータベース定義によってeolbeがExact Online Belgiumと関連付けられている場合に、Exact Online Belgiumの使用を指定します。

いくつかの特別な「サービスプロバイダー」は常に存在し、例えばエイリアスで使用されるDataDictionaryなどがあります。

dataContainerAlias

%%{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))

目的

settings.xml内でデータベース用に複数のデータコンテナが定義されている場合、それぞれにエイリアスが割り当てられます。 エイリアスは通常、限られた数の文字で構成されます。 エイリアスが存在することで、Invantive UniversalSQLはデータ要求をどのデータコンテナに転送すべきかを正確に判断できます。

passingSourceOrPathExpression

%%{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))

目的

passingオプションは、解釈される内容のソースを指定します。 内容は、先行するread_file()テーブル関数からの結果、httpget()を使用してダウンロードされたURL、または文字列連結などの式の結果として指定できます。 内容は、式として指定されたファイル名およびパスで識別される特定のファイルから取得するものとして指定することもできます。

groupBy

%%{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))

目的

複数行のグループへのまとめは、groupByによって指定します。 列に挙げられた列の値の異なる組み合わせごとに、グループが1つ導入されます。 グループ化された列の値は、select句で使用できます。 グループ化されていない列は、「aggregateFunction」として挙げられたグループ関数のコンテキスト内でのみ使用できます。

havingClause

%%{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))

目的

having句は、where句が行を保持するのと同様に、ブール条件が真となるグループを保持します。 条件ではグループ関数を使用でき、group byがなくても使用できます。その場合、全体の集合が1つのグループになります。 リリース28.0から利用可能です。Grouping#Filtering Groups with Havingを参照してください。

orderBy

%%{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))

目的

ソート項目のリストで指定された順序に従って、返される行をソートします。 値は昇順(デフォルト)または降順でソートされます。 昇順ソートではNULL値が最初に、降順ソートでは最後に来ます。

テキストは各文字のコード(序数)によってソートされ、言語設定に関係なくどのコンピューターでも同じ結果になります。大文字は小文字の前に来、アクセント付きの文字はzの後に来るため、'B'は'a'の前に、'z'は'é'の前に来ます。 同じ順序はlimit、min、max、listagg、betweenにも適用され、<および>によるテキストの比較にも適用されます。 リリース27.0まではソートにコンピューターの言語設定が使用され、'a'を'B'の前に配置していました。リリース28.0以降、ソートは序数になります。 ソート項目でlower(...)またはupper(...)を使用すると、大文字と小文字を区別せずにソートできます。

ソート項目は次のいずれかです:

  • select リスト内の列の名前または列のエイリアス;
  • select リストにない、from句内のテーブルの列の名前;
  • select リスト内の位置。例えば、2は2番目の列を指し、展開後の*の列を数えます。
  • price * quantityやlower(name)などの式。select リストにない場合も含みます。
  • 相関サブクエリ。

位置は、1から列数までの整数である必要があります。最後の列を超える位置を指定するとitgensql911が発生し、'a'や1.5などのその他の定数ではitgensql910が発生します。 select リストのエイリアスは、単独で使用される場合のみソート項目として認識され、式の中では認識されません。

場合によっては、select リストにない式は許可されません。 式を select リストに追加するか、代わりにその位置でソートしてください:

  • union、intersect、minusの場合、列名または結果の位置(itgensql912)のみが許可されます;
  • select distinctの場合、式は select リストになければなりません(itgensql913);
  • group byまたは select リスト内の集計の場合、式は select リストになければなりません(itgensql914);
  • topの場合、式は select リストになければなりません(itgensql915)。limitにはこのような制限はありません。

次の例では、2番目の列を金額の大きい順にソートし、その後1番目の列でソートします:

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

次の例では、select リストにない式でソートします:

select rge.value id
from   range@datadictionary(5) rge
order
by     mod(rge.value * 7, 10)

id
--
 3
 2
 5
 1
 4

次の例はテキストの序数順を示しています。大文字が小文字の前に来ます:

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

次の例では、同じテキストを大文字と小文字を区別せずにソートし、大文字小文字のみが異なる2つのテキストでは大文字を先に配置します:

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

%%{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

%%{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))

目的

ソート方向は、'asc'(昇順、デフォルト)または'desc'(降順)のいずれかを指定できます。

columnList

%%{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))

目的

カンマ区切りの列のリスト。

sortedColumnList

%%{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))

目的

ソート対象の列値のカンマ区切りの順序付きリスト。

sortedColumn

%%{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))

目的

ソート対象の値: 列、select リスト内の位置、または式で、必要に応じてソート方向が続きます。

列

%%{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))

目的

列は識別子で識別され、必要に応じて、列を取得するテーブルの名前またはテーブルのエイリアスが前に付きます。

columnNoAliasList

%%{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

%%{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

%%{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))

目的

where句は、行が満たす必要のある1つ以上のブール条件を適用することで、結果セットの行数を制限します。

joinStatements

%%{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))

目的

join文のリスト。

joinStatement

%%{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

目的

結合文は2つの結果セットを組み合わせます。 結合条件を満たす場合にのみ、両方の結果セットから取得した行の組み合わせが返されます。

リリース 28.0 以降、データソースの前にあるカンマは、SQL標準のテーブル参照リストと同様にクロス結合です。#dataSource を参照してください。

joinCategory

%%{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))

目的

結合カテゴリは、対象となる行の組み合わせを指定します。 次のバリアントを使用できます:

  • inner join: 'join' または 'inner join' で示されます。内部結合は、結合条件を満たす両方の結果セットのすべての行の組み合わせを返します。
  • left outer: 'left outer join' で示されます。左外部結合は内部結合と同じ行を返しますが、右の結果セットに一致する行がない左の結果セットの各行について1行が追加されます。 右の結果セットに由来する各列にはnull値が割り当てられます。
  • right outer: 'right outer join' で示されます。右外部結合は内部結合と同じ行を返しますが、左の結果セットに一致する行がない右の結果セットの各行について1行が追加されます。 左の結果セットに由来する各列にはnull値が割り当てられます。
  • full outer: 'full outer join' で示されます。完全外部結合は内部結合と同じ行を返しますが、左の結果セットに一致する行がない右の結果セットの各行について1行が追加されます。 左の結果セットに由来する各列にはnull値が割り当てられます。 さらに、右の結果セットに一致する行がない左の結果セットの各行についても1行が追加されます。 右の結果セットに由来する各列にはnull値が割り当てられます。 リリース 28.0 までは、右側のテーブル関数またはそれに基づくインラインビューとの完全外部結合は左外部結合として処理されたため、右側で相手のない行が欠落していました。 リリース 27.0 および 28.0 では、テーブル関数の引数が左側の列を参照する場合を除き、完全外部結合として処理されます。そのような結合は、SQL標準に従い itgenjir004 で拒否されます。 その場合は代わりに左外部結合を使用してください。
  • cross join: 'cross join' で示されます。クロス結合は、両方の結果セットの行の直積を返します。 「直積」は集合論の用語で、すべての組み合わせが返されることを示します。 SQL標準では、'cross join' の後に結合条件を指定することは許可されていません。 Invantive UniversalSQLでは、そこに on を指定でき、その条件付きの内部結合と同じ行を返します。 リリース 27.0 まで(これを含む)では、クロス結合は右の結果セットを除外していました。select count(*) from t a cross join t b は t の行数を返し、その2乗ではありませんでした。また、右側のエイリアスへの参照は itgensql035 で失敗する場合がありました。

joinSubCategory

%%{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))

目的

結合のサブカテゴリは、結合カテゴリを絞り込みます。 説明は 'joinCategory' を参照してください。

joinConditions

%%{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))

目的

結合の有効な組み合わせを定義するブール式です。

selectList

%%{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

%%{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))

エイリアス付き

%%{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))

ラベル付き

%%{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))

目的

式のテキストラベルを定義します。 ラベルには、'' の形式のリソース(例: 'My ')を含めることができます。 式のデータ型やエイリアスと同様に、ラベルは選択をまたいで保持されます。 計算またはSQL関数を適用すると、ラベルは空の値にリセットされます。 ユーザーインターフェースは、より自然な操作性のために、利用可能な場合は列名の代わりにラベルを表示することを選択できます。

部分

%%{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

%%{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))

目的

SQL文または使用される1つ以上のデータソースから、すべての列を選択します。 except句は、リストされた名前以外のすべての列の取得を可能にします。 except句は通常、列リストが変わる可能性のある幅広い結果セットで、事前に定義された一部の列を除外する必要がある場合に使用されます。

複数の名前は、txn.* except (period, ledger_id) のように括弧で囲んで記述するのが最適です。 括弧がない場合、最初の名前以外の名前も、エイリアスやラベルのない単純な列であり、アスタリスクが返し、かつまだ除外されていないものである限り除外されます。txn.* except period, ledger_id は両方を除外します。 それに該当しない最初の要素(式や別のデータソースの列など)から、fzl.* except id, fte.afkorting のように選択リストの残りが始まります。 すでに除外されている列は再度選択されるため、* except volgorde, volgorde では volgorde が最後に配置されます。 複数の名前の後に付くプレフィックス、ポストフィックス、またはラベルのプレフィックスやポストフィックスには、常に括弧が必要です。txn.* except period, ledger_id prefix with 'x_' は構文エラーです。

フォーラムトピック 7006 の修正前のリリース 27.0 では、括弧なしの最初の名前のみが取得され、それ以降の名前はアスタリスクがすでに返したコピーに加えて、ledger_id2 のような独自の名前で2回目に選択されていました。

アスタリスクにエイリアスが付いている場合、except句の名前はそのエイリアスの列であり、他のデータソースの列ではありません。 別のデータソースも持つ名前は、except句では曖昧ではないため、独自のエイリアスは不要です。 エイリアスが持たない名前は、存在しない列として報告されます。

allColumnsSpecId

%%{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

%%{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))

目的

select all ('') 演算子によって選択された列のエイリアスを、元のエイリアスに指定したテキストを前置して定義します。 例えば、select演算子は接頭辞 'pjt_' を付けた列 'code' のエイリアスを 'pjt_code' に変更します。

allColumnsSpecColumnNamePostfix

%%{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))

目的

select all ('') 演算子によって選択された列のエイリアスを、元のエイリアスに指定したテキストを後置して定義します。 例えば、select演算子は後置 'from_table2' を付けた列 'code' のエイリアスを 'code_from_table2' に変更します。

allColumnsSpecLabelPrefix

%%{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))

目的

select all ('') 演算子によって選択された列のラベルを、元のラベルに指定したテキストを前置して定義します。 例えば、select演算子は接頭辞 'Project ' を付けた列 'name' のラベル 'Name' を 'Project Name' に変更します。

allColumnsSpecLabelPostfix

%%{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))

目的

select all ('') 演算子によって選択された列のラベルを、元のラベルに指定したテキストを後置して定義します。 例えば、select演算子は、後置子「 from Table2」を付けて列「name」のラベル「Name」を「Name from Table2」に変更します。

orReplace

%%{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))