Documentation Source Text

Check-in [0c43e7efb4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make the "select-stmt" syntax diagram a closer fit to reality.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0c43e7efb4f0924c42fc44a7a59bdfb11cf0a33c
User & Date: drh 2014-01-30 19:39:31
Context
2014-01-30
20:51
Add the "factored-select-stmt" syntax diagram. Improve the way diagrams are hidden and shown. check-in: fac98d12ae user: drh tags: trunk
19:39
Make the "select-stmt" syntax diagram a closer fit to reality. check-in: 0c43e7efb4 user: drh tags: trunk
17:41
Fix FROM clause in the SELECT syntax diagrams. Also fix typos in the text. check-in: a115a033da user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to art/syntax/bubble-generator-data.tcl.

341
342
343
344
345
346
347


348
349
350
351
352
353
354
355
356
357
358
359
360
361
362



363
364
365
366
367
368
369
             /collation-name
             {line {optx /database-name .}
                 {tailbranch /table-name /index-name}
             }
          }
  }
  select-stmt {


   loop 
     {or
        {stack
            {opt {line WITH {opt RECURSIVE} {loop common-table-expression ,}}}
            {line SELECT {or nil DISTINCT ALL}
                                           {loop result-column ,}}
            {optx FROM {or {loop table-or-subquery ,} join-clause}}
            {optx WHERE expr}
            {optx GROUP BY {loop expr ,} {optx HAVING expr}}
            {optx ORDER BY {loop ordering-term ,}}
            {optx LIMIT expr {optx {or OFFSET ,} expr}}
        }
        {line VALUES {loop {line ( {loop expr ,} )} ,}}
     }
     compound-operator



  }
  join-clause {
    line
      table-or-subquery
      {opt {loop {line join-operator table-or-subquery join-constraint}}}
  }
  simple-select-stmt {







>
>
|
|
|
<
|
|
|
|
|
<
<
|
|
|
|
>
>
>







341
342
343
344
345
346
347
348
349
350
351
352

353
354
355
356
357


358
359
360
361
362
363
364
365
366
367
368
369
370
371
             /collation-name
             {line {optx /database-name .}
                 {tailbranch /table-name /index-name}
             }
          }
  }
  select-stmt {
   stack
     {opt {line WITH {opt RECURSIVE} {loop common-table-expression ,}}}
     {loop 
       {or
          {stack

              {line SELECT {or nil DISTINCT ALL}
                                             {loop result-column ,}}
              {optx FROM {or {loop table-or-subquery ,} join-clause}}
              {optx WHERE expr}
              {optx GROUP BY {loop expr ,} {optx HAVING expr}}


          }
          {line VALUES {loop {line ( {loop expr ,} )} ,}}
       }
       compound-operator
     }
     {optx ORDER BY {loop ordering-term ,}}
     {optx LIMIT expr {optx {or OFFSET ,} expr}}
  }
  join-clause {
    line
      table-or-subquery
      {opt {loop {line join-operator table-or-subquery join-constraint}}}
  }
  simple-select-stmt {

Changes to art/syntax/select-stmt.gif.

cannot compute difference between binary files

Changes to pages/lang.in.

3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
SELECT statement syntax as possible in a single diagram, as some readers
find that helpful.  Alternative syntax diagrams that break the syntax down
into smaller chunks are shown elsewhere in this document.

<p>Note that there are paths through the syntax diagrams that
are not allowed in practice.  Some examples:
<ul>
<li>An [ORDER BY] or [LIMIT] clause can only occur on the right-most 
    SELECT of a [compound select].
<li>A [VALUES] clause can be the first element in a [compound SELECT]
    that uses a [WITH] clause, but a [simple SELECT] that consists of
    just a [VALUES] clause cannot be preceded by a [WITH] clause.
<li>The [WITH] clause must occur on the first SELECT of a [compound SELECT].
    It cannot follow a [compound-operator].
</ul>
These and other similar syntax restrictions are described in the text.







<
<







3620
3621
3622
3623
3624
3625
3626


3627
3628
3629
3630
3631
3632
3633
SELECT statement syntax as possible in a single diagram, as some readers
find that helpful.  Alternative syntax diagrams that break the syntax down
into smaller chunks are shown elsewhere in this document.

<p>Note that there are paths through the syntax diagrams that
are not allowed in practice.  Some examples:
<ul>


<li>A [VALUES] clause can be the first element in a [compound SELECT]
    that uses a [WITH] clause, but a [simple SELECT] that consists of
    just a [VALUES] clause cannot be preceded by a [WITH] clause.
<li>The [WITH] clause must occur on the first SELECT of a [compound SELECT].
    It cannot follow a [compound-operator].
</ul>
These and other similar syntax restrictions are described in the text.