Documentation Source Text

Check-in [5df6adc2a9]
Login

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

Overview
Comment:Changes to lang_update.html to make it more testable.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5df6adc2a9b2cc6de71d974c50f1c894f72a1325
User & Date: dan 2010-09-20 19:09:31
Context
2010-09-21
16:58
Further changes to lang_update.html. check-in: e7259b8c39 user: dan tags: trunk
2010-09-20
19:09
Changes to lang_update.html to make it more testable. check-in: 5df6adc2a9 user: dan tags: trunk
2010-09-18
18:52
Tweaks to lang_insert.html. check-in: 15cc2204a5 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pages/lang.in.

2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
....
2978
2979
2980
2981
2982
2983
2984
2985
2986












2987
2988






2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000


3001
3002
3003
3004
3005

3006
3007
3008
3009
3010



3011
3012
3013
3014
3015
3016
3017

</ul>

<p>^The optional conflict-clause allows the specification of an alternative
constraint conflict resolution algorithm to use during this one INSERT command.
See the section titled
[ON CONFLICT] for additional information.
^For compatibility with MySQL, the parser allows the use of the
single keyword <a href="lang_replace.html">REPLACE</a> as an 
alias for "INSERT OR REPLACE".

<p>^(The optional "<i>database-name</i><b>.</b>" prefix on the <i>table-name</i>
is support for top-level INSERT statements only.)^  ^The table name must be
unqualified for INSERT statements that occur within [CREATE TRIGGER] statements.
^Similarly, the "DEFAULT VALUES" form of the INSERT statement is supported for
................................................................................
##############################################################################
Section UPDATE update {UPDATE *UPDATEs}

BubbleDiagram update-stmt 1
BubbleDiagram qualified-table-name
</tcl>

<p>^The UPDATE statement is used to change the value of columns in 
selected rows of a table.  ^Each assignment in an UPDATE specifies












a column name to the left of the equals sign and an arbitrary expression
to the right.  ^The expressions may use the values of other columns.






^All expressions are evaluated before any assignments are made.
^A WHERE clause can be used to restrict which rows are updated.</p>

<p>^The optional conflict-clause allows the specification of an alternative
constraint conflict resolution algorithm to use during this one UPDATE command.
See the section titled
[ON CONFLICT] for additional information.</p>

<h3>Restrictions on UPDATE Statements Within CREATE TRIGGER</h3>

<p>^There are additional syntax restrictions on UPDATE statements that
occur within the body of a [CREATE TRIGGER] statement.  ^The <i>table-name</i>


of the UPDATE must be unqualified. 
^(In other words, the <i>database-name</i><b>.</b> prefix 
on the table name of the UPDATE is not allowed within triggers.)^
^The table to be updated must be in the same
database as the table to which the trigger is attached.</p>


<p>^The INDEXED BY and NOT INDEXED clauses are not allowed on UPDATE
statements within triggers.</p>

<p>^The LIMIT clause for UPDATE is unsupported within triggers.</p>




<h3>Optional LIMIT and ORDER BY Clauses</h3>

<p>^(If SQLite is built with the [SQLITE_ENABLE_UPDATE_DELETE_LIMIT]
compile-time option then the syntax of the UPDATE statement is extended
with optional ORDER BY and LIMIT clauses)^ as follows:</p>








|







 







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

|

<
|



|
|
>
>
|
|
|
<
|
>

|
|

<
>
>
>







2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
....
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999

3000
3001
3002
3003
3004
3005
3006

3007
3008
3009

3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020

3021
3022
3023
3024
3025
3026

3027
3028
3029
3030
3031
3032
3033
3034
3035
3036

</ul>

<p>^The optional conflict-clause allows the specification of an alternative
constraint conflict resolution algorithm to use during this one INSERT command.
See the section titled
[ON CONFLICT] for additional information.
For compatibility with MySQL, ^the parser allows the use of the
single keyword <a href="lang_replace.html">REPLACE</a> as an 
alias for "INSERT OR REPLACE".

<p>^(The optional "<i>database-name</i><b>.</b>" prefix on the <i>table-name</i>
is support for top-level INSERT statements only.)^  ^The table name must be
unqualified for INSERT statements that occur within [CREATE TRIGGER] statements.
^Similarly, the "DEFAULT VALUES" form of the INSERT statement is supported for
................................................................................
##############################################################################
Section UPDATE update {UPDATE *UPDATEs}

BubbleDiagram update-stmt 1
BubbleDiagram qualified-table-name
</tcl>

<p>^An UPDATE statement is used to modify a subset of the values stored in 
zero or more rows of the database table identified by the 
<i>qualified-table-name</i> specified as part of the UPDATE statement.

<p>^If the UPDATE statement does not have a WHERE clause, all rows in the
table are modified by the UPDATE. ^(Otherwise, the UPDATE affects only those
rows for which evaluating the WHERE clause expression and 
[CAST expression|casting the result] to a NUMERIC value produces a value other
than NULL or zero (integer value 0 or real value 0.0).)^ ^It is not an error if
the WHERE clause does not evaluate to a non-NULL, non-zero value for any row in
the table - this just means that the UPDATE statement affects zero rows.

<p>The modifications made to each row affected by an UPDATE statement are
determined by the list of assignments following the SET keyword. Each
assignment specifies a column name to the left of the equals sign and a

scalar expression to the right. ^For each affected row, the named columns
are set to the values found by evaluating the corresponding scalar 
expressions. ^If a single column-name appears more than once in the list of
assignment expressions, all but the rightmost occurence is ignored. ^Columns
that do not appear in the list of assignments are left unmodified. ^The scalar
expressions may refer to columns of the row being updated. ^In this case all
scalar expressions are evaluated before any assignments are made.


<p>^The optional conflict-clause allows the user to nominate a specific
constraint conflict resolution algorithm to use during this one UPDATE command.

Refer to the section entitled [ON CONFLICT] for additional information.

<h3>Restrictions on UPDATE Statements Within CREATE TRIGGER</h3>

<p>The following additional syntax restrictions apply to UPDATE statements that
occur within the body of a [CREATE TRIGGER] statement.  

<ul>
  <li><p>^The <i>table-name</i> of the UPDATE must be unqualified. ^(In other
      words, the <i>database-name</i><b>.</b> prefix on the table name of the
      UPDATE is not allowed within triggers.)^ ^The table to be updated must 

      reside in the same database as the table to which the trigger is
      attached.

  <li><p>^The INDEXED BY and NOT INDEXED clauses are not allowed on UPDATE
      statements within triggers.</p>


  <li><p>^The LIMIT and ORDER BY clauses for UPDATE are unsupported within
      triggers, regardless of the compilation options used to build SQLite.
</ul>

<h3>Optional LIMIT and ORDER BY Clauses</h3>

<p>^(If SQLite is built with the [SQLITE_ENABLE_UPDATE_DELETE_LIMIT]
compile-time option then the syntax of the UPDATE statement is extended
with optional ORDER BY and LIMIT clauses)^ as follows:</p>