Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch coreDocs Excluding Merge-Ins
This is equivalent to a diff from 6fc137b4c3 to 6e651ad0df
2014-02-05
| ||
01:39 | Refresh all included SQLite core library documentation (e.g. SQL syntax). check-in: 3e112a4504 user: mistachkin tags: trunk | |
01:39 | Update version history docs. Closed-Leaf check-in: 6e651ad0df user: mistachkin tags: coreDocs | |
01:36 | Some readability improvements to the NDoc3/HtmlHelp build script. check-in: 1e20c68e20 user: mistachkin tags: coreDocs | |
00:04 | Import new SQLite core docs. check-in: c221f9714d user: mistachkin tags: coreDocs | |
2014-02-04
| ||
22:55 | Reorganize the documentation files. check-in: 6fc137b4c3 user: mistachkin tags: trunk | |
08:07 | For the MSBuild based SQLite interop assembly projects, make sure the solution settings file is imported after the properties files. check-in: f7ed2c1f03 user: mistachkin tags: trunk | |
Added Doc/Extra/Core/images/sqlite370_banner.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/a.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/alter-table-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/analyze-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/attach-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/begin-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/column-constraint.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/column-def.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/comment-syntax.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/commit-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/common-table-expression.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/compound-operator.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/compound-select-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/conflict-clause.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/create-index-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/create-table-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/create-trigger-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/create-view-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/create-virtual-table-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/cte-table-name.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/delete-stmt-limited.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/delete-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/detach-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/drop-index-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/drop-table-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/drop-trigger-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/drop-view-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/expr.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/factored-select-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/floating-point-literal.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/foreign-key-clause.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/foreign-key-clause2.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/indexed-column.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/insert-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/join-clause.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/join-constraint.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/join-op.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/join-operator.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/join-source.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/literal-value.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/numeric-literal.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/ordering-term.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/pragma-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/pragma-value.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/qualified-table-name.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/raise-function.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/recursive-cte.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/reindex-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/release-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/result-column.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/rollback-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/savepoint-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/select-core.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/select-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/signed-number.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/simple-select-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/single-source.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/sql-stmt-list.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/sql-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/table-constraint.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/table-or-subquery.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/type-name.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/update-stmt-limited.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/update-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/vacuum-stmt.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/images/syntax/with-clause.gif.
cannot compute difference between binary files
Added Doc/Extra/Core/lang.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Query Language Understood by SQLite</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align=center>SQL As Understood By SQLite</h1> <p>SQLite understands most of the standard SQL language. But it does <a href="omitted.html">omit some features</a> while at the same time adding a few features of its own. This document attempts to describe precisely what parts of the SQL language SQLite does and does not support. A list of <a href="lang_keywords.html">SQL keywords</a> is also provided. The SQL language syntax is described by <a href="syntaxdiagrams.html">syntax diagrams</a>. <p>The following syntax documentation topics are available:</p> <table width="100%" cellpadding="5" border="0"> <tr><td valign="top"><ul> <li><a href="lang_aggfunc.html">aggregate functions</a></li><li><a href="lang_altertable.html">ALTER TABLE</a></li><li><a href="lang_analyze.html">ANALYZE</a></li><li><a href="lang_attach.html">ATTACH DATABASE</a></li><li><a href="lang_transaction.html">BEGIN TRANSACTION</a></li><li><a href="lang_comment.html">comment</a></li><li><a href="lang_transaction.html">COMMIT TRANSACTION</a></li><li><a href="lang_corefunc.html">core functions</a></li><li><a href="lang_createindex.html">CREATE INDEX</a></li><li><a href="lang_createtable.html">CREATE TABLE</a></li><li><a href="lang_createtrigger.html">CREATE TRIGGER</a></li><li><a href="lang_createview.html">CREATE VIEW</a></li><li><a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a></li></ul></td><td valign="top"><ul><li><a href="lang_datefunc.html">date and time functions</a></li><li><a href="lang_delete.html">DELETE</a></li><li><a href="lang_detach.html">DETACH DATABASE</a></li><li><a href="lang_dropindex.html">DROP INDEX</a></li><li><a href="lang_droptable.html">DROP TABLE</a></li><li><a href="lang_droptrigger.html">DROP TRIGGER</a></li><li><a href="lang_dropview.html">DROP VIEW</a></li><li><a href="lang_transaction.html">END TRANSACTION</a></li><li><a href="lang_explain.html">EXPLAIN</a></li><li><a href="lang_expr.html">expression</a></li><li><a href="lang_indexedby.html">INDEXED BY</a></li><li><a href="lang_insert.html">INSERT</a></li><li><a href="lang_keywords.html">keywords</a></li></ul></td><td valign="top"><ul><li><a href="lang_conflict.html">ON CONFLICT clause</a></li><li><a href="pragma.html#syntax">PRAGMA</a></li><li><a href="lang_reindex.html">REINDEX</a></li><li><a href="lang_savepoint.html">RELEASE SAVEPOINT</a></li><li><a href="lang_replace.html">REPLACE</a></li><li><a href="lang_transaction.html">ROLLBACK TRANSACTION</a></li><li><a href="lang_savepoint.html">SAVEPOINT</a></li><li><a href="lang_select.html">SELECT</a></li><li><a href="lang_update.html">UPDATE</a></li><li><a href="lang_vacuum.html">VACUUM</a></li><li><a href="lang_with.html">WITH clause</a></li> </ul></td></tr></table> <p>The routines <a href="c3ref/prepare.html">sqlite3_prepare_v2()</a>, <a href="c3ref/prepare.html">sqlite3_prepare()</a>, <a href="c3ref/prepare.html">sqlite3_prepare16()</a>, <a href="c3ref/prepare.html">sqlite3_prepare16_v2()</a>, <a href="c3ref/exec.html">sqlite3_exec()</a>, and <a href="c3ref/free_table.html">sqlite3_get_table()</a> accept an SQL statement list (sql-stmt-list) which is a semicolon-separated list of statements.</p> <p><b><a href="syntaxdiagrams.html#sql-stmt-list">sql-stmt-list:</a></b></p><blockquote> <img alt="syntax diagram sql-stmt-list" src="images/syntax/sql-stmt-list.gif"></img> </blockquote> <p>Each SQL statement in the statement list is an instance of the following:</p> <p><b><a href="syntaxdiagrams.html#sql-stmt">sql-stmt:</a></b></p><blockquote> <img alt="syntax diagram sql-stmt" src="images/syntax/sql-stmt.gif"></img> </blockquote> |
Added Doc/Extra/Core/lang_aggfunc.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: Aggregate Functions</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>Aggregate Functions</h2> <p> The aggregate functions shown below are available by default. Additional aggregate functions written in C may be added using the <a href="c3ref/create_function.html">sqlite3_create_function()</a></a> API.</p> <p> In any aggregate function that takes a single argument, that argument can be preceded by the keyword DISTINCT. In such cases, duplicate elements are filtered before being passed into the aggregate function. For example, the function "count(distinct X)" will return the number of distinct values of column X instead of the total number of non-null values in column X. </p> <table border=0 cellpadding=10> <tr><td valign="top" align="right" width="120"><a name="avg"></a> avg(<i>X</i>)</td><td valign="top"> The avg() function returns the average value of all non-NULL <i>X</i> within a group. String and BLOB values that do not look like numbers are interpreted as 0. The result of avg() is always a floating point value as long as at there is at least one non-NULL input even if all inputs are integers. The result of avg() is NULL if and only if there are no non-NULL inputs. </td></tr><tr><td valign="top" align="right" width="120"><a name="count"></a> count(<i>X</i>)<br />count(*)</td><td valign="top"> The count(X) function returns a count of the number of times that <i>X</i> is not NULL in a group. The count(*) function (with no arguments) returns the total number of rows in the group. </td></tr><tr><td valign="top" align="right" width="120"><a name="groupconcat"></a> group_concat(<i>X</i>)<br />group_concat(<i>X</i>,<i>Y</i>)</td><td valign="top"> The group_concat() function returns a string which is the concatenation of all non-NULL values of <i>X</i>. If parameter <i>Y</i> is present then it is used as the separator between instances of <i>X</i>. A comma (",") is used as the separator if <i>Y</i> is omitted. The order of the concatenated elements is arbitrary. </td></tr><tr><td valign="top" align="right" width="120"><a name="maxggunc"></a> max(<i>X</i>)</td><td valign="top"> The max() aggregate function returns the maximum value of all values in the group. The maximum value is the value that would be returned last in an ORDER BY on the same column. Aggregate max() returns NULL if and only if there are no non-NULL values in the group. </td></tr><tr><td valign="top" align="right" width="120"><a name="minggunc"></a> min(<i>X</i>)</td><td valign="top"> The min() aggregate function returns the minimum non-NULL value of all values in the group. The minimum value is the first non-NULL value that would appear in an ORDER BY of the column. Aggregate min() returns NULL if and only if there are no non-NULL values in the group. </td></tr><tr><td valign="top" align="right" width="120"><a name="sumunc"></a> sum(<i>X</i>)<br />total(<i>X</i>)</td><td valign="top"> The sum() and total() aggregate functions return sum of all non-NULL values in the group. If there are no non-NULL input rows then sum() returns NULL but total() returns 0.0. NULL is not normally a helpful result for the sum of no rows but the SQL standard requires it and most other SQL database engines implement sum() that way so SQLite does it in the same way in order to be compatible. The non-standard total() function is provided as a convenient way to work around this design problem in the SQL language.</p> <p>The result of total() is always a floating point value. The result of sum() is an integer value if all non-NULL inputs are integers. If any input to sum() is neither an integer or a NULL then sum() returns a floating point value which might be an approximation to the true sum.</p> <p>Sum() will throw an "integer overflow" exception if all inputs are integers or NULL and an integer overflow occurs at any point during the computation. Total() never throws an integer overflow. </td></tr> </table> |
Changes to Doc/Extra/Core/lang_altertable.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < > > > > > > > | > > > > | > > > > > > > > > > > > > | > > > > | < < | | | < | > | < < < < < < | > | > > | > | > | > > > > | > | > > | < > > | < < < < > > > > > > > > > > > > > > > > | > > > > > | < < | < < < < > > > > > | | | | > | < > > > > > > > > > > > > > > > | < | > | | | | | | | | > > > > > > > > | > > > > | < < < > > > > > > > > | > > | | | | | | | | < < < | > > > > | < | | | > > > > > > > > > > > > > > > > > > > | > > > > > > > > | < < | > > | | > > > | | > > | > | | > > > > > > | | < > > | > > > | > > > > > > | > > > > > > > > | | < < > > > > | | > > > | | > > | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: ALTER TABLE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>ALTER TABLE</h2><p><b><a href="syntaxdiagrams.html#alter-table-stmt">alter-table-stmt:</a></b> <button id='x729' onclick='hideorshow("x729","x730")'>hide</button></p> <blockquote id='x730'> <img alt="syntax diagram alter-table-stmt" src="images/syntax/alter-table-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#column-def">column-def:</a></b> <button id='x731' onclick='hideorshow("x731","x732")'>show</button></p> <blockquote id='x732' style='display:none;'> <img alt="syntax diagram column-def" src="images/syntax/column-def.gif" /> <p><b><a href="syntaxdiagrams.html#column-constraint">column-constraint:</a></b> <button id='x733' onclick='hideorshow("x733","x734")'>show</button></p> <blockquote id='x734' style='display:none;'> <img alt="syntax diagram column-constraint" src="images/syntax/column-constraint.gif" /> <p><b><a href="syntaxdiagrams.html#conflict-clause">conflict-clause:</a></b> <button id='x735' onclick='hideorshow("x735","x736")'>show</button></p> <blockquote id='x736' style='display:none;'> <img alt="syntax diagram conflict-clause" src="images/syntax/conflict-clause.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x737' onclick='hideorshow("x737","x738")'>show</button></p> <blockquote id='x738' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x739' onclick='hideorshow("x739","x740")'>show</button></p> <blockquote id='x740' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x741' onclick='hideorshow("x741","x742")'>show</button></p> <blockquote id='x742' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x743' onclick='hideorshow("x743","x744")'>show</button></p> <blockquote id='x744' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x745' onclick='hideorshow("x745","x746")'>show</button></p> <blockquote id='x746' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x747' onclick='hideorshow("x747","x748")'>show</button></p> <blockquote id='x748' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x749' onclick='hideorshow("x749","x750")'>show</button></p> <blockquote id='x750' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x751' onclick='hideorshow("x751","x752")'>show</button></p> <blockquote id='x752' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x753' onclick='hideorshow("x753","x754")'>show</button></p> <blockquote id='x754' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x755' onclick='hideorshow("x755","x756")'>show</button></p> <blockquote id='x756' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x757' onclick='hideorshow("x757","x758")'>show</button></p> <blockquote id='x758' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#foreign-key-clause">foreign-key-clause:</a></b> <button id='x759' onclick='hideorshow("x759","x760")'>show</button></p> <blockquote id='x760' style='display:none;'> <img alt="syntax diagram foreign-key-clause" src="images/syntax/foreign-key-clause.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x761' onclick='hideorshow("x761","x762")'>show</button></p> <blockquote id='x762' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x763' onclick='hideorshow("x763","x764")'>show</button></p> <blockquote id='x764' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x765' onclick='hideorshow("x765","x766")'>show</button></p> <blockquote id='x766' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x767' onclick='hideorshow("x767","x768")'>show</button></p> <blockquote id='x768' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> </blockquote> <p>SQLite supports a limited subset of ALTER TABLE. The ALTER TABLE command in SQLite allows the user to rename a table or to add a new column to an existing table. </p> <p> The RENAME TO syntax is used to rename the table identified by <i>[database-name.]table-name</i> to <i>new-table-name</i>. This command cannot be used to move a table between attached databases, only to rename a table within the same database.</p> <p> If the table being renamed has triggers or indices, then these remain attached to the table after it has been renamed. However, if there are any view definitions, or statements executed by triggers that refer to the table being renamed, these are not automatically modified to use the new table name. If this is required, the triggers or view definitions must be dropped and recreated to use the new table name by hand. </p> <p>If <a href="foreignkeys.html">foreign key constraints</a> are <a href="pragma.html#pragma_foreign_keys">enabled</a> when a table is renamed, then any <a href="syntaxdiagrams.html#foreign-key-clause">REFERENCES clauses</a> in any table (either the table being renamed or some other table) that refer to the table being renamed are modified to refer to the renamed table by its new name. <p> The ADD COLUMN syntax is used to add a new column to an existing table. The new column is always appended to the end of the list of existing columns. The <a href="syntaxdiagrams.html#column-def">column-def</a> rule defines the characteristics of the new column. The new column may take any of the forms permissible in a <a href="lang_createtable.html">CREATE TABLE</a> statement, with the following restrictions: <ul> <li>The column may not have a PRIMARY KEY or UNIQUE constraint.</li> <li>The column may not have a default value of CURRENT_TIME, CURRENT_DATE, CURRENT_TIMESTAMP, or an expression in parentheses.</li> <li>If a NOT NULL constraint is specified, then the column must have a default value other than NULL. <li>If <a href="foreignkeys.html">foreign key constraints</a> are <a href="pragma.html#pragma_foreign_keys">enabled</a> and a column with a <a href="syntaxdiagrams.html#foreign-key-clause">REFERENCES clause</a> is added, the column must have a default value of NULL. </ul> <p>Note also that when adding a <a href="lang_createtable.html#ckconst">CHECK constraint</a>, the CHECK constraint is not tested against preexisting rows of the table. This can result in a table that contains data that is in violation of the CHECK constraint. Future versions of SQLite might change to validate CHECK constraints as they are added.</p> <p> The execution time of the ALTER TABLE command is independent of the amount of data in the table. The ALTER TABLE command runs as quickly on a table with 10 million rows as it does on a table with 1 row. </p> <p>After ADD COLUMN has been run on a database, that database will not be readable by SQLite version 3.1.3 and earlier.</p> |
Changes to Doc/Extra/Core/lang_analyze.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < | > > > > | > > > > | < < > | | | | | | > > > > > > | > > > > | | | < | > > | > > | > > | | > > > > > > > > > | > > | < > > | < < < < | < < > > > > > | < | < > > > > > > | > | > > > > > | < < | < < < < | < | | | | < < | | | | > | > > > > > > > | > | > | | > | | > | | > > > > > > > > > > | < < < > > > | | > > > > > > > > > > > > | > > > > | > > > > > > | | | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: ANALYZE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>ANALYZE</h2><p><b><a href="syntaxdiagrams.html#analyze-stmt">analyze-stmt:</a></b> <button id='x769' onclick='hideorshow("x769","x770")'>hide</button></p> <blockquote id='x770'> <img alt="syntax diagram analyze-stmt" src="images/syntax/analyze-stmt.gif" /> </blockquote> <p> The ANALYZE command gathers statistics about tables and indices and stores the collected information in <a href="fileformat2.html#intschema">internal tables</a> of the database where the query optimizer can access the information and use it to help make better query planning choices. If no arguments are given, all attached databases are analyzed. If a database name is given as the argument, then all tables and indices in that one database are analyzed. If the argument is a table name, then only that table and the indices associated with that table are analyzed. If the argument is an index name, then only that one index is analyzed.</p> <p> The default implementation stores all statistics in a single table named "<a href="fileformat2.html#stat1tab">sqlite_stat1</a>". If SQLite is compiled with the <a href="compile.html#enable_stat3">SQLITE_ENABLE_STAT3</a> option and without the <a href="compile.html#enable_stat4">SQLITE_ENABLE_STAT4</a> option, then additional histogram data is collected and stored in <a href="fileformat2.html#stat3tab">sqlite_stat3</a>. If SQLite is compiled with the <a href="compile.html#enable_stat4">SQLITE_ENABLE_STAT4</a> option, then additional histogram data is collected and stored in <a href="fileformat2.html#stat4tab">sqlite_stat4</a>. Older versions of SQLite would make use of the <a href="fileformat2.html#stat2tab">sqlite_stat2</a> table when compiled with <a href="compile.html#enable_stat2">SQLITE_ENABLE_STAT2</a> but all recent versions of SQLite ignore the sqlite_stat2 table. Future enhancements may create additional <a href="fileformat2.html#intschema">internal tables</a> with the same name pattern except with final digit larger than "4". All of these tables are collectively referred to as "statistics tables". </p> <p> The content of the statistics tables can be queried using <a href="lang_select.html">SELECT</a> and can be changed using the <a href="lang_delete.html">DELETE</a>, <a href="lang_insert.html">INSERT</a>, and <a href="lang_update.html">UPDATE</a> commands. The <a href="lang_droptable.html">DROP TABLE</a> command works on statistics tables as of SQLite version 3.7.9. The <a href="lang_altertable.html">ALTER TABLE</a> command does not work on statistics tables. Appropriate care should be used when changing the content of the statistics tables as invalid content can cause SQLite to select inefficient query plans. Generally speaking, one should not modify the content of the statistics tables by any mechanism other than invoking the ANALYZE command. See "<a href="optoverview.html#manctrl">Manual Control Of Query Plans Using SQLITE_STAT Tables</a>" for further information.</p> <p> Statistics gathered by ANALYZE are not automatically updated as the content of the database changes. If the content of the database changes significantly, or if the database schema changes, then one should consider rerunning the ANALYZE command in order to update the statistics.</p> <p> The query planner loads the content of the statistics tables into memory when the schema is read. Hence, when an application changes the statistics tables directly, SQLite will not immediately notice the changes. An application can force the query planner to reread the statistics tables by running <b>ANALYZE sqlite_master</b>. </p> <p> |
Changes to Doc/Extra/Core/lang_attach.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < | < > | | | | | | | > | > > > > > > > > > > > > > > > > > > | | | | > > | | > | > > | > | > | > > > > | > | > > | < > > | | < > | < > > > > > > > > > > > > > | > > > > > | < < | < < < > > > > > | | | | | | < < < | > > > | | | | > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > | | | | | > | > > | > | > > | < < | | > > > | | > > > > > > > | < | > > > > > > > > > | | > > > | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: ATTACH DATABASE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>ATTACH DATABASE</h2><p><b><a href="syntaxdiagrams.html#attach-stmt">attach-stmt:</a></b> <button id='x771' onclick='hideorshow("x771","x772")'>hide</button></p> <blockquote id='x772'> <img alt="syntax diagram attach-stmt" src="images/syntax/attach-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x773' onclick='hideorshow("x773","x774")'>show</button></p> <blockquote id='x774' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x775' onclick='hideorshow("x775","x776")'>show</button></p> <blockquote id='x776' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x777' onclick='hideorshow("x777","x778")'>show</button></p> <blockquote id='x778' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x779' onclick='hideorshow("x779","x780")'>show</button></p> <blockquote id='x780' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x781' onclick='hideorshow("x781","x782")'>show</button></p> <blockquote id='x782' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x783' onclick='hideorshow("x783","x784")'>show</button></p> <blockquote id='x784' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x785' onclick='hideorshow("x785","x786")'>show</button></p> <blockquote id='x786' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x787' onclick='hideorshow("x787","x788")'>show</button></p> <blockquote id='x788' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x789' onclick='hideorshow("x789","x790")'>show</button></p> <blockquote id='x790' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x791' onclick='hideorshow("x791","x792")'>show</button></p> <blockquote id='x792' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x793' onclick='hideorshow("x793","x794")'>show</button></p> <blockquote id='x794' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x795' onclick='hideorshow("x795","x796")'>show</button></p> <blockquote id='x796' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x797' onclick='hideorshow("x797","x798")'>show</button></p> <blockquote id='x798' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x799' onclick='hideorshow("x799","x800")'>show</button></p> <blockquote id='x800' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> </blockquote> <p> The ATTACH DATABASE statement adds another database file to the current <a href="c3ref/sqlite3.html">database connection</a>. The filename for the database to be attached is the value of the expression that occurs before the AS keyword. The filename of the database follows the same semantics as the filename argument to <a href="c3ref/open.html">sqlite3_open()</a> and <a href="c3ref/open.html">sqlite3_open_v2()</a>; the special name "<a href="inmemorydb.html">:memory:</a>" results in an <a href="inmemorydb.html">in-memory database</a> and an empty string results in a new temporary database. The filename argument can be a <a href="uri.html">URI filename</a> if URI filename processing is enable on the database connection. The default behavior is for URI filenames to be disabled, however that might change in a future release of SQLite, so application developers are advised to plan accordingly. <p>The name that occurs after the AS keyword is the name of the database used internally by SQLite. The database-names 'main' and 'temp' refer to the main database and the database used for temporary tables. The main and temp databases cannot be attached or detached.</p> <p> Tables in an attached database can be referred to using the syntax <i>database-name.table-name</i>. If the name of the table is unique across all attached databases and the main and temp databases, then the <i>database-name</i> prefix is not required. If two or more tables in different databases have the same name and the <i>database-name</i> prefix is not used on a table reference, then the table chosen is the one in the database that was least recently attached.</p> <p> Transactions involving multiple attached databases are atomic, assuming that the main database is not "<a href="inmemorydb.html">:memory:</a>" and the <a href="pragma.html#pragma_journal_mode">journal_mode</a> is not <a href="wal.html">WAL</a>. If the main database is ":memory:" or if the journal_mode is WAL, then transactions continue to be atomic within each individual database file. But if the host computer crashes in the middle of a <a href="lang_transaction.html">COMMIT</a> where two or more database files are updated, some of those files might get the changes where others might not. </p> <p> There is a limit, set using <a href="c3ref/limit.html">sqlite3_limit()</a> and <a href="c3ref/c_limit_attached.html#sqlitelimitattached">SQLITE_LIMIT_ATTACHED</a>, to the number of databases that can be simultaneously attached to a single database connection.</p> |
Changes to Doc/Extra/Core/lang_comment.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < | < > > > | | | | | | | | | | | | > > > > > > > > | > > > | | | | | > > | > > | > > | > | | | | | | | | | < < < < < | | < > > > > | > > | | > > | > > > > > > > > > > > > > > > | < < < | < < < < > > > > > > > | | > | > > > > > > > | > > | | | | | > > | | > | > | | | | | | | | < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: comment</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>comment</h2><p><b><a href="syntaxdiagrams.html#comment-syntax">comment-syntax:</a></b> <button id='x805' onclick='hideorshow("x805","x806")'>hide</button></p> <blockquote id='x806'> <img alt="syntax diagram comment-syntax" src="images/syntax/comment-syntax.gif" /> </blockquote> <p>Comments are not SQL commands, but can occur within the text of SQL queries passed to <a href="c3ref/prepare.html">sqlite3_prepare_v2()</a> and related interfaces. Comments are treated as whitespace by the parser. Comments can begin anywhere whitespace can be found, including inside expressions that span multiple lines. </p> <p>SQL comments begin with two consecutive "-" characters (ASCII 0x2d) and extend up to and including the next newline character (ASCII 0x0a) or until the end of input, whichever comes first.</p> <p>C-style comments begin with "/*" and extend up to and including the next "*/" character pair or until the end of input, whichever comes first. C-style comments can span multiple lines. </p> <p>Comments can appear anywhere whitespace can occur, including inside expressions and in the middle of other SQL statements. Comments do not nest. </p> |
Changes to Doc/Extra/Core/lang_conflict.html.
|
| | | | | | < | > > | > | > > | > | < | < | < > | | > > | > > > > | | | > | < | | | | < > | | > | > > > > | > | > > | < > > > > > > > > | > > > > | | | | < | > | > | | > > | < | < < < | < < > > > > > < < | < < < < < | | | | < | | | < > > > > > > > > > | < > > > > > > > > > > > < > | > | | < | | > > > | | < | | > | > > > > > | | > > > > | < < | | > > > > > | > > | > > > > | | | | < > | < < | > > > | | | | < < | | < | > > > > | | | < | > > > > > | > > | > | < > | > > > > | < < < < | | | | | > > > > | < < > | | > > > | < < > > > > | | | > > > | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: ON CONFLICT clause</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>ON CONFLICT clause</h2><p><b><a href="syntaxdiagrams.html#conflict-clause">conflict-clause:</a></b> <button id='x1117' onclick='hideorshow("x1117","x1118")'>hide</button></p> <blockquote id='x1118'> <img alt="syntax diagram conflict-clause" src="images/syntax/conflict-clause.gif" /> </blockquote> <p>The ON CONFLICT clause is not a separate SQL command. It is a non-standard clause that can appear in many other SQL commands. It is given its own section in this document because it is not part of standard SQL and therefore might not be familiar.</p> <p>The syntax for the ON CONFLICT clause is as shown above for the CREATE TABLE command. For the INSERT and UPDATE commands, the keywords "ON CONFLICT" are replaced by "OR" so that the syntax reads more naturally. For example, instead of "INSERT ON CONFLICT IGNORE" we have "INSERT OR IGNORE". The keywords change but the meaning of the clause is the same either way.</p> <p>The ON CONFLICT clause applies to UNIQUE and NOT NULL constraints (and to PRIMARY KEY constraints which for the purposes of this section are the same thing as UNIQUE constraints). The ON CONFLICT algorithm does not apply to <a href="foreignkeys.html">FOREIGN KEY constraints</a>. There are five conflict resolution algorithm choices: ROLLBACK, ABORT, FAIL, IGNORE, and REPLACE. The default conflict resolution algorithm is ABORT. This is what they mean:</p> <dl> <dt><b>ROLLBACK</b></dt> <dd><p> When an applicable constraint violation occurs, the ROLLBACK resolution algorithm aborts the current SQL statement with an SQLITE_CONSTRAINT error and rolls back the current transaction. If no transaction is active (other than the implied transaction that is created on every command) then the ROLLBACK resolution algorithm works the same as the ABORT algorithm.</p></dd> <dt><b>ABORT</b></dt> <dd><p> When an applicable constraint violation occurs, the ABORT resolution algorithm aborts the current SQL statement with an SQLITE_CONSTRAINT error and backs out any changes made by the current SQL statement; but changes caused by prior SQL statements within the same transaction are preserved and the transaction remains active. This is the default behavior and the behavior specified by the SQL standard.</p></dd> <dt><b>FAIL</b></dt> <dd><p> When an applicable constraint violation occurs, the FAIL resolution algorithm aborts the current SQL statement with an SQLITE_CONSTRAINT error. But the FAIL resolution does not back out prior changes of the SQL statement that failed nor does it end the transaction. For example, if an UPDATE statement encountered a constraint violation on the 100th row that it attempts to update, then the first 99 row changes are preserved but changes to rows 100 and beyond never occur.</p></dd> <dt><b>IGNORE</b></dt> <dd><p> When an applicable constraint violation occurs, the IGNORE resolution algorithm skips the one row that contains the constraint violation and continues processing subsequent rows of the SQL statement as if nothing went wrong. Other rows before and after the row that contained the constraint violation are inserted or updated normally. No error is returned when the IGNORE conflict resolution algorithm is used.</p></dd> <dt><b>REPLACE</b></dt> <dd><p> When a UNIQUE constraint violation occurs, the REPLACE algorithm deletes pre-existing rows that are causing the constraint violation prior to inserting or updating the current row and the command continues executing normally. If a NOT NULL constraint violation occurs, the REPLACE conflict resolution replaces the NULL value with the default value for that column, or if the column has no default value, then the ABORT algorithm is used. If a CHECK constraint violation occurs, the REPLACE conflict resolution algorithm always works like ABORT.</p> <p>When the REPLACE conflict resolution strategy deletes rows in order to satisfy a constraint, <a href="lang_createtrigger.html">delete triggers</a> fire if and only if <a href="pragma.html#pragma_recursive_triggers">recursive triggers</a> are enabled.</p> <p>The <a href="c3ref/update_hook.html">update hook</a> is not invoked for rows that are deleted by the REPLACE conflict resolution strategy. Nor does REPLACE increment the <a href="c3ref/changes.html">change counter</a>. The exceptional behaviors defined in this paragraph might change in a future release.</p> </dl> <p>The algorithm specified in the OR clause of an INSERT or UPDATE overrides any algorithm specified in a CREATE TABLE. If no algorithm is specified anywhere, the ABORT algorithm is used.</p> |
Added Doc/Extra/Core/lang_corefunc.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: Core Functions</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>Core Functions</h2> <p>The core functions shown below are available by default. <a href="lang_datefunc.html">Date & Time functions</a> and <a href="lang_aggfunc.html">aggregate functions</a> are documented separately. An application may define additional functions written in C and added to the database engine using the <a href="c3ref/create_function.html">sqlite3_create_function()</a> API.</p> <table border=0 cellpadding=10> <tr><td valign="top" align="right" width="120"><a name="abs"></a> abs(<i>X</i>)</td><td valign="top"> The abs(X) function returns the absolute value of the numeric argument X. Abs(X) returns NULL if X is NULL. Abs(X) return 0.0 if X is a string or blob that cannot be converted to a numeric value. If X is the integer -9223372036854775808 then abs(X) throws an integer overflow error since there is no equivalent positive 64-bit two complement value. </td></tr><tr><td valign="top" align="right" width="120"><a name="changes"></a> changes()</td><td valign="top"> The changes() function returns the number of database rows that were changed or inserted or deleted by the most recently completed INSERT, DELETE, or UPDATE statement, exclusive of statements in lower-level triggers. The changes() SQL function is a wrapper around the <a href="c3ref/changes.html">sqlite3_changes()</a> C/C++ function and hence follows the same rules for counting changes. </td></tr><tr><td valign="top" align="right" width="120"><a name="char"></a> char(<i>X1</i>,<i>X2</i>,...,<i>XN</i>)</td><td valign="top"> The char(X1,X2,...,XN) function returns a string composed of characters having the unicode code point values of integers X1 through XN, respectively. </td></tr><tr><td valign="top" align="right" width="120"><a name="coalesce"></a> coalesce(<i>X</i>,<i>Y</i>,...)</td><td valign="top"> The coalesce() function returns a copy of its first non-NULL argument, or NULL if all arguments are NULL. Coalesce() must have at least 2 arguments. </td></tr><tr><td valign="top" align="right" width="120"><a name="glob"></a> glob(<i>X</i>,<i>Y</i>)</td><td valign="top"> The glob(X,Y) function is equivalent to the expression "<b>Y GLOB X</b>". Note that the X and Y arguments are reversed in the glob() function relative to the infix <a href="lang_expr.html#glob">GLOB</a> operator. If the <a href="c3ref/create_function.html">sqlite3_create_function()</a> interface is used to override the glob(X,Y) function with an alternative implementation then the <a href="lang_expr.html#glob">GLOB</a> operator will invoke the alternative implementation. </td></tr><tr><td valign="top" align="right" width="120"><a name="ifnull"></a> ifnull(<i>X</i>,<i>Y</i>)</td><td valign="top"> The ifnull() function returns a copy of its first non-NULL argument, or NULL if both arguments are NULL. Ifnull() must have exactly 2 arguments. The ifnull() function is equivalent to <a href="lang_corefunc.html#coalesce">coalesce()</a> with two arguments. </td></tr><tr><td valign="top" align="right" width="120"><a name="instr"></a> instr(<i>X</i>,<i>Y</i>)</td><td valign="top"> The instr(X,Y) function finds the first occurrence of string Y within string X and returns the number of prior characters plus 1, or 0 if Y is nowhere found within X. Or, if X and Y are both BLOBs, then instr(X,Y) returns one more than the number bytes prior to the first occurrence of Y, or 0 if Y does not occur anywhere within X. If both arguments X and Y to instr(X,Y) are non-NULL and are not BLOBs then both are interpreted as strings. If either X or Y are NULL in instr(X,Y) then the result is NULL. </td></tr><tr><td valign="top" align="right" width="120"><a name="hex"></a> hex(<i>X</i>)</td><td valign="top"> The hex() function interprets its argument as a BLOB and returns a string which is the upper-case hexadecimal rendering of the content of that blob. </td></tr><tr><td valign="top" align="right" width="120"><a name="last_insert_rowid"></a> last_insert_rowid()</td><td valign="top"> The last_insert_rowid() function returns the <a href="lang_createtable.html#rowid">ROWID</a> of the last row insert from the database connection which invoked the function. The last_insert_rowid() SQL function is a wrapper around the <a href="c3ref/last_insert_rowid.html">sqlite3_last_insert_rowid()</a> C/C++ interface function. </td></tr><tr><td valign="top" align="right" width="120"><a name="length"></a> length(<i>X</i>)</td><td valign="top"> For a string value X, the length(X) function returns the number of characters (not bytes) in X prior to the first NUL character. Since SQLite strings do not normally contain NUL characters, the length(X) function will usually return the total number of characters in the string X. For a blob value X, length(X) returns the number of bytes in the blob. If X is NULL then length(X) is NULL. If X is numeric then length(X) returns the length of a string representation of X. </td></tr><tr><td valign="top" align="right" width="120"><a name="like"></a> like(<i>X</i>,<i>Y</i>)<br />like(<i>X</i>,<i>Y</i>,<i>Z</i>)</td><td valign="top"> The like() function is used to implement the "<b>Y LIKE X [ESCAPE Z]</b>" expression. If the optional ESCAPE clause is present, then the like() function is invoked with three arguments. Otherwise, it is invoked with two arguments only. Note that the X and Y parameters are reversed in the like() function relative to the infix <a href="lang_expr.html#like">LIKE</a> operator. The <a href="c3ref/create_function.html">sqlite3_create_function()</a> interface can be used to override the like() function and thereby change the operation of the <a href="lang_expr.html#like">LIKE</a> operator. When overriding the like() function, it may be important to override both the two and three argument versions of the like() function. Otherwise, different code may be called to implement the <a href="lang_expr.html#like">LIKE</a> operator depending on whether or not an ESCAPE clause was specified. </td></tr><tr><td valign="top" align="right" width="120"><a name="likelihood"></a> likelihood(<i>X</i>,<i>Y</i>)</td><td valign="top"> The likelihood(X,Y) function returns argument X unchanged. The value Y in likelihood(X,Y) must be a floating point constant between 0.0 and 1.0, inclusive. The likelihood(X) function is a no-op that the code generator optimizes away so that it consumes no CPU cycles during run-time (that is, during calls to <a href="c3ref/step.html">sqlite3_step()</a>). The purpose of the likelihood(X,Y) function is to provide a hint to the query planner that the argument X is a boolean that is true with a probability of approximately Y. The <a href="lang_corefunc.html#unlikely">unlikely(X)</a> function is short-hand for likelihood(X,0.0625). </td></tr><tr><td valign="top" align="right" width="120"><a name="load_extension"></a> load_extension(<i>X</i>)<br />load_extension(<i>X</i>,<i>Y</i>)</td><td valign="top"> The load_extension(X,Y) function loads <a href="loadext.html">SQLite extensions</a> out of the shared library file named X using the entry point Y. The result of load_extension() is always a NULL. If Y is omitted then the default entry point name is used. The load_extension() function raises an exception if the extension fails to load or initialize correctly. <p>The load_extension() function will fail if the extension attempts to modify or delete an SQL function or collating sequence. The extension can add new functions or collating sequences, but cannot modify or delete existing functions or collating sequences because those functions and/or collating sequences might be used elsewhere in the currently running SQL statement. To load an extension that changes or deletes functions or collating sequences, use the <a href="c3ref/load_extension.html">sqlite3_load_extension()</a> C-language API.</p> <p>For security reasons, extension loaded is turned off by default and must be enabled by a prior call to <a href="c3ref/enable_load_extension.html">sqlite3_enable_load_extension()</a>.</p> </td></tr><tr><td valign="top" align="right" width="120"><a name="lower"></a> lower(<i>X</i>)</td><td valign="top"> The lower(X) function returns a copy of string X with all ASCII characters converted to lower case. The default built-in lower() function works for ASCII characters only. To do case conversions on non-ASCII characters, load the ICU extension. </td></tr><tr><td valign="top" align="right" width="120"><a name="ltrim"></a> ltrim(<i>X</i>)<br />ltrim(<i>X</i>,<i>Y</i>)</td><td valign="top"> The ltrim(X,Y) function returns a string formed by removing any and all characters that appear in Y from the left side of X. If the Y argument is omitted, ltrim(X) removes spaces from the left side of X. </td></tr><tr><td valign="top" align="right" width="120"><a name="maxoreunc"></a> max(<i>X</i>,<i>Y</i>,...)</td><td valign="top"> The multi-argument max() function returns the argument with the maximum value, or return NULL if any argument is NULL. The multi-argument max() function searches its arguments from left to right for an argument that defines a collating function and uses that collating function for all string comparisons. If none of the arguments to max() define a collating function, then the BINARY collating function is used. Note that <b>max()</b> is a simple function when it has 2 or more arguments but operates as an <a href="lang_aggfunc.html#minggunc">aggregate function</a> if given only a single argument. </td></tr><tr><td valign="top" align="right" width="120"><a name="minoreunc"></a> min(<i>X</i>,<i>Y</i>,...)</td><td valign="top"> The multi-argument min() function returns the argument with the minimum value. The multi-argument min() function searches its arguments from left to right for an argument that defines a collating function and uses that collating function for all string comparisons. If none of the arguments to min() define a collating function, then the BINARY collating function is used. Note that <b>min()</b> is a simple function when it has 2 or more arguments but operates as an <a href="lang_aggfunc.html#maxggunc">aggregate function</a> if given only a single argument. </td></tr><tr><td valign="top" align="right" width="120"><a name="nullif"></a> nullif(<i>X</i>,<i>Y</i>)</td><td valign="top"> The nullif(X,Y) function returns its first argument if the arguments are different and NULL if the arguments are the same. The nullif(X,Y) function searches its arguments from left to right for an argument that defines a collating function and uses that collating function for all string comparisons. If neither argument to nullif() defines a collating function then the BINARY is used. </td></tr><tr><td valign="top" align="right" width="120"><a name="printf"></a> printf(<i>FORMAT</i>,...)</td><td valign="top"> The printf(FORMAT,...) SQL function works like the <a href="c3ref/mprintf.html">sqlite3_mprintf()</a> C-language function and the printf() function from the standard C library. The first argument is a format string that specifies how to construct the output string using values taken from subsequent arguments. If the FORMAT argument is missing or NULL then the result is NULL. The %n format is silently ignored and does not consume an argument. The %p format is an alias for %X. The %z format is interchangeable with %s. If there are too few arguments in the argument list, missing arguments are assumed to have a NULL value, which is translated into 0 or 0.0 for numeric formats or an empty string for %s. </td></tr><tr><td valign="top" align="right" width="120"><a name="quote"></a> quote(<i>X</i>)</td><td valign="top"> The quote(X) function returns the text of an SQL literal which is the value of its argument suitable for inclusion into an SQL statement. Strings are surrounded by single-quotes with escapes on interior quotes as needed. BLOBs are encoded as hexadecimal literals. Strings with embedded NUL characters cannot be represented as string literals in SQL and hence the returned string literal is truncated prior to the first NUL. </td></tr><tr><td valign="top" align="right" width="120"><a name="random"></a> random()</td><td valign="top"> The random() function returns a pseudo-random integer between -9223372036854775808 and +9223372036854775807. </td></tr><tr><td valign="top" align="right" width="120"><a name="randomblob"></a> randomblob(<i>N</i>)</td><td valign="top"> The randomblob(N) function return an N-byte blob containing pseudo-random bytes. If N is less than 1 then a 1-byte random blob is returned. <p>Hint: applications can generate globally unique identifiers using this function together with <a href="lang_corefunc.html#hex">hex()</a> and/or <a href="lang_corefunc.html#lower">lower()</a> like this:</p> <blockquote> hex(randomblob(16))<br></br> lower(hex(randomblob(16))) </blockquote> </td></tr><tr><td valign="top" align="right" width="120"><a name="replace"></a> replace(<i>X</i>,<i>Y</i>,<i>Z</i>)</td><td valign="top"> The replace(X,Y,Z) function returns a string formed by substituting string Z for every occurrence of string Y in string X. The <a href="datatype3.html#collation">BINARY</a> collating sequence is used for comparisons. If Y is an empty string then return X unchanged. If Z is not initially a string, it is cast to a UTF-8 string prior to processing. </td></tr><tr><td valign="top" align="right" width="120"><a name="round"></a> round(<i>X</i>)<br />round(<i>X</i>,<i>Y</i>)</td><td valign="top"> The round(X,Y) function returns a floating-point value X rounded to Y digits to the right of the decimal point. If the Y argument is omitted, it is assumed to be 0. </td></tr><tr><td valign="top" align="right" width="120"><a name="rtrim"></a> rtrim(<i>X</i>)<br />rtrim(<i>X</i>,<i>Y</i>)</td><td valign="top"> The rtrim(X,Y) function returns a string formed by removing any and all characters that appear in Y from the right side of X. If the Y argument is omitted, rtrim(X) removes spaces from the right side of X. </td></tr><tr><td valign="top" align="right" width="120"><a name="soundex"></a> soundex(<i>X</i>)</td><td valign="top"> The soundex(X) function returns a string that is the soundex encoding of the string X. The string "?000" is returned if the argument is NULL or contains no ASCII alphabetic characters. This function is omitted from SQLite by default. It is only available if the <a href="compile.html#soundex">SQLITE_SOUNDEX</a> compile-time option is used when SQLite is built. </td></tr><tr><td valign="top" align="right" width="120"><a name="sqlite_compileoption_get"></a> sqlite_compileoption_get(<i>N</i>)</td><td valign="top"> The sqlite_compileoption_get() SQL function is a wrapper around the <a href="c3ref/compileoption_get.html">sqlite3_compileoption_get()</a> C/C++ function. This routine returns the N-th compile-time option used to build SQLite or NULL if N is out of range. See also the <a href="pragma.html#pragma_compile_options">compile_options pragma</a>. </td></tr><tr><td valign="top" align="right" width="120"><a name="sqlite_compileoption_used"></a> sqlite_compileoption_used(<i>X</i>)</td><td valign="top"> The sqlite_compileoption_used() SQL function is a wrapper around the <a href="c3ref/compileoption_get.html">sqlite3_compileoption_used()</a> C/C++ function. When the argument X to sqlite_compileoption_used(X) is a string which is the name of a compile-time option, this routine returns true (1) or false (0) depending on whether or not that option was used during the build. </td></tr><tr><td valign="top" align="right" width="120"><a name="sqlite_source_id"></a> sqlite_source_id()</td><td valign="top"> The sqlite_source_id() function returns a string that identifies the specific version of the source code that was used to build the SQLite library. The string returned by sqlite_source_id() begins with the date and time that the source code was checked in and is follows by an SHA1 hash that uniquely identifies the source tree. This function is an SQL wrapper around the <a href="c3ref/libversion.html">sqlite3_sourceid()</a> C interface. </td></tr><tr><td valign="top" align="right" width="120"><a name="sqlite_version"></a> sqlite_version()</td><td valign="top"> The sqlite_version() function returns the version string for the SQLite library that is running. This function is an SQL wrapper around the <a href="c3ref/libversion.html">sqlite3_libversion()</a> C-interface. </td></tr><tr><td valign="top" align="right" width="120"><a name="substr"></a> substr(<i>X</i>,<i>Y</i>,<i>Z</i>)<br />substr(<i>X</i>,<i>Y</i>)</td><td valign="top"> The substr(X,Y,Z) function returns a substring of input string X that begins with the Y-th character and which is Z characters long. If Z is omitted then substr(X,Y) returns all characters through the end of the string X beginning with the Y-th. The left-most character of X is number 1. If Y is negative then the first character of the substring is found by counting from the right rather than the left. If Z is negative then the abs(Z) characters preceding the Y-th character are returned. If X is a string then characters indices refer to actual UTF-8 characters. If X is a BLOB then the indices refer to bytes. </td></tr><tr><td valign="top" align="right" width="120"><a name="total_changes"></a> total_changes()</td><td valign="top"> The total_changes() function returns the number of row changes caused by INSERT, UPDATE or DELETE statements since the current database connection was opened. This function is a wrapper around the <a href="c3ref/total_changes.html">sqlite3_total_changes()</a> C/C++ interface. </td></tr><tr><td valign="top" align="right" width="120"><a name="trim"></a> trim(<i>X</i>)<br />trim(<i>X</i>,<i>Y</i>)</td><td valign="top"> The trim(X,Y) function returns a string formed by removing any and all characters that appear in Y from both ends of X. If the Y argument is omitted, trim(X) removes spaces from both ends of X. </td></tr><tr><td valign="top" align="right" width="120"><a name="typeof"></a> typeof(<i>X</i>)</td><td valign="top"> The typeof(X) function returns a string that indicates the <a href="datatype3.html">datatype</a> of the expression X: "null", "integer", "real", "text", or "blob". </td></tr><tr><td valign="top" align="right" width="120"><a name="unlikely"></a> unlikely(<i>X</i>)</td><td valign="top"> The unlikely(X) function returns the argument X unchanged. The unlikely(X) function is a no-op that the code generator optimizes away so that it consumes no CPU cycles at run-time (that is, during calls to <a href="c3ref/step.html">sqlite3_step()</a>). The purpose of the unlikely(X) function is to provide a hint to the query planner that the argument X is a boolean value that is usually not true. The unlikely(X) function is equivalent to <a href="lang_corefunc.html#likelihood">likelihood</a>(X, 0.0625). </td></tr><tr><td valign="top" align="right" width="120"><a name="unicode"></a> unicode(<i>X</i>)</td><td valign="top"> The unicode(X) function returns the numeric unicode code point corresponding to the first character of the string X. If the argument to unicode(X) is not a string then the result is undefined. </td></tr><tr><td valign="top" align="right" width="120"><a name="upper"></a> upper(<i>X</i>)</td><td valign="top"> The upper(X) function returns a copy of input string X in which all lower-case ASCII characters are converted to their upper-case equivalent. </td></tr><tr><td valign="top" align="right" width="120"><a name="zeroblob"></a> zeroblob(<i>N</i>)</td><td valign="top"> The zeroblob(N) function returns a BLOB consisting of N bytes of 0x00. SQLite manages these zeroblobs very efficiently. Zeroblobs can be used to reserve space for a BLOB that is later written using <a href="c3ref/blob_open.html">incremental BLOB I/O</a>. This SQL function is implemented using the <a href="c3ref/result_blob.html">sqlite3_result_zeroblob()</a> routine from the C/C++ interface. </td></tr> </table> |
Changes to Doc/Extra/Core/lang_createindex.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | > > > > > > > > | < | < < > | < | > > > | | | | | | | | | > > > > > > > > > > > > > > > > | | | | > > | | > | > > | > | > | > > > > | > | > > | < > > | > > > | < > | < > > > > > > > > > > | > > > > > | < < | < < < > > > > > | > > | > | > | | | | | > > > > > > | > > > > | < < > > > > > > > > | < < < < < > > > > | > > > > > > > > | > > > > | | < < < < < < > > > > | < < < < > > > > > > > > > > > > > > > | | | > | < | | > > > > > > | | | > | | < > | | > | > > > > > > > > > | | | > > > > > | | > > > > | | | > > > > > > > | | > > | > | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: CREATE INDEX</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>CREATE INDEX</h2><p><b><a href="syntaxdiagrams.html#create-index-stmt">create-index-stmt:</a></b> <button id='x807' onclick='hideorshow("x807","x808")'>hide</button></p> <blockquote id='x808'> <img alt="syntax diagram create-index-stmt" src="images/syntax/create-index-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x809' onclick='hideorshow("x809","x810")'>show</button></p> <blockquote id='x810' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x811' onclick='hideorshow("x811","x812")'>show</button></p> <blockquote id='x812' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x813' onclick='hideorshow("x813","x814")'>show</button></p> <blockquote id='x814' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x815' onclick='hideorshow("x815","x816")'>show</button></p> <blockquote id='x816' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x817' onclick='hideorshow("x817","x818")'>show</button></p> <blockquote id='x818' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x819' onclick='hideorshow("x819","x820")'>show</button></p> <blockquote id='x820' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x821' onclick='hideorshow("x821","x822")'>show</button></p> <blockquote id='x822' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x823' onclick='hideorshow("x823","x824")'>show</button></p> <blockquote id='x824' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x825' onclick='hideorshow("x825","x826")'>show</button></p> <blockquote id='x826' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x827' onclick='hideorshow("x827","x828")'>show</button></p> <blockquote id='x828' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x829' onclick='hideorshow("x829","x830")'>show</button></p> <blockquote id='x830' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x831' onclick='hideorshow("x831","x832")'>show</button></p> <blockquote id='x832' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x833' onclick='hideorshow("x833","x834")'>show</button></p> <blockquote id='x834' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x835' onclick='hideorshow("x835","x836")'>show</button></p> <blockquote id='x836' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#indexed-column">indexed-column:</a></b> <button id='x837' onclick='hideorshow("x837","x838")'>show</button></p> <blockquote id='x838' style='display:none;'> <img alt="syntax diagram indexed-column" src="images/syntax/indexed-column.gif" /> </blockquote> </blockquote> <p>The CREATE INDEX command consists of the keywords "CREATE INDEX" followed by the name of the new index, the keyword "ON", the name of a previously created table that is to be indexed, and a parenthesized list of names of columns in the table that are used for the index key. If the optional WHERE clause is included, then the index is a "<a href="partialindex.html">partial index</a>". </p> <a name="descidx"></a> <p>Each column name can be followed by one of the "ASC" or "DESC" keywords to indicate sort order. The sort order may or may not be ignored depending on the database file format, and in particular the <a href="fileformat2.html#schemaformat">schema format number</a>. The "legacy" schema format (1) ignores index sort order. The descending index schema format (4) takes index sort order into account. Only versions of SQLite 3.3.0 and later are able to understand the descending index format. For compatibility, version of SQLite between 3.3.0 and 3.7.9 use the legacy schema format by default. The newer schema format is used by default in version 3.7.10 and later. The <a href="pragma.html#pragma_legacy_file_format">legacy_file_format pragma</a> can be used to change set the specific behavior for any version of SQLite.</p> <p>The COLLATE clause optionally following each column name defines a collating sequence used for text entries in that column. The default collating sequence is the collating sequence defined for that column in the <a href="lang_createtable.html">CREATE TABLE</a> statement. Or if no collating sequence is otherwise defined, the built-in BINARY collating sequence is used.</p> <p>There are no arbitrary limits on the number of indices that can be attached to a single table. The number of columns in an index is limited to the value set by <a href="c3ref/limit.html">sqlite3_limit</a>(<a href="c3ref/c_limit_attached.html#sqlitelimitcolumn">SQLITE_LIMIT_COLUMN</a>,...).</p> <a name="uniqueidx"></a> <p>If the UNIQUE keyword appears between CREATE and INDEX then duplicate index entries are not allowed. Any attempt to insert a duplicate entry will result in an error. For the purposes of unique indices, all NULL values are considered to different from all other NULL values and are thus unique. This is one of the two possible interpretations of the SQL-92 standard (the language in the standard is ambiguous) and is the interpretation followed by PostgreSQL, MySQL, Firebird, and Oracle. Informix and Microsoft SQL Server follow the other interpretation of the standard.</p> <p>If the optional IF NOT EXISTS clause is present and another index with the same name already exists, then this command becomes a no-op.</p> <p>Indexes are removed with the <a href="lang_dropindex.html">DROP INDEX</a> command.</p> |
Changes to Doc/Extra/Core/lang_createtable.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | > > > > | > > | > > > > | > > > > > > > > > > > > > | > > > > | < < | | | < | > | < > > > > | < | | < | | | | > > > | | | > > | > > > > > > > > > > > > > > > > > > | > | < < > > > < > | < < < < | > > > > | | | | | > | > > > > | < > > | > > > > > > > > > > > > > > > > > | | | | | > | < | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > | | | | < | > | | | | | | > | > > > > | > > > > > > > > | < > > > > > > > > > > > | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | > | < | | | | | | | | | | | > > > > > > > > > > > > | | > > > | > > | > | | | | | | | | | | | | | | | > | > | | < < > > > | | < < > > > > > > > > | | | > > > > > > > | > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | > > > > > > | > > > > | | > > > | > | > > > | > > > > > > > > > > > > | | | > | | | > > > | > > > > | > | > | > | < > > > > > | > > | < > > | | > | > > > > > > > > > > > > > > | | | > > > > > > | < > | > > > | < | < < < < > > > > | | | | | | > > | > | > > | | | | > | > > > > > | > > > > > > > > > > | > | > | | | < > | | | | | | | > > | > > > > > > | > > > > > > > > > | > > > > > > > > | | | | > > | | < < > | | > | | > > > > > > > | > > > > > > > | > > > > | > > | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: CREATE TABLE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>CREATE TABLE</h2><p><b><a href="syntaxdiagrams.html#create-table-stmt">create-table-stmt:</a></b> <button id='x839' onclick='hideorshow("x839","x840")'>hide</button></p> <blockquote id='x840'> <img alt="syntax diagram create-table-stmt" src="images/syntax/create-table-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#column-def">column-def:</a></b> <button id='x841' onclick='hideorshow("x841","x842")'>show</button></p> <blockquote id='x842' style='display:none;'> <img alt="syntax diagram column-def" src="images/syntax/column-def.gif" /> <p><b><a href="syntaxdiagrams.html#column-constraint">column-constraint:</a></b> <button id='x843' onclick='hideorshow("x843","x844")'>show</button></p> <blockquote id='x844' style='display:none;'> <img alt="syntax diagram column-constraint" src="images/syntax/column-constraint.gif" /> <p><b><a href="syntaxdiagrams.html#conflict-clause">conflict-clause:</a></b> <button id='x845' onclick='hideorshow("x845","x846")'>show</button></p> <blockquote id='x846' style='display:none;'> <img alt="syntax diagram conflict-clause" src="images/syntax/conflict-clause.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x847' onclick='hideorshow("x847","x848")'>show</button></p> <blockquote id='x848' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x849' onclick='hideorshow("x849","x850")'>show</button></p> <blockquote id='x850' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#foreign-key-clause">foreign-key-clause:</a></b> <button id='x851' onclick='hideorshow("x851","x852")'>show</button></p> <blockquote id='x852' style='display:none;'> <img alt="syntax diagram foreign-key-clause" src="images/syntax/foreign-key-clause.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x853' onclick='hideorshow("x853","x854")'>show</button></p> <blockquote id='x854' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x855' onclick='hideorshow("x855","x856")'>show</button></p> <blockquote id='x856' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x857' onclick='hideorshow("x857","x858")'>show</button></p> <blockquote id='x858' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x859' onclick='hideorshow("x859","x860")'>show</button></p> <blockquote id='x860' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x861' onclick='hideorshow("x861","x862")'>show</button></p> <blockquote id='x862' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x863' onclick='hideorshow("x863","x864")'>show</button></p> <blockquote id='x864' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x865' onclick='hideorshow("x865","x866")'>show</button></p> <blockquote id='x866' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x867' onclick='hideorshow("x867","x868")'>show</button></p> <blockquote id='x868' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x869' onclick='hideorshow("x869","x870")'>show</button></p> <blockquote id='x870' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x871' onclick='hideorshow("x871","x872")'>show</button></p> <blockquote id='x872' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x873' onclick='hideorshow("x873","x874")'>show</button></p> <blockquote id='x874' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x875' onclick='hideorshow("x875","x876")'>show</button></p> <blockquote id='x876' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x877' onclick='hideorshow("x877","x878")'>show</button></p> <blockquote id='x878' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x879' onclick='hideorshow("x879","x880")'>show</button></p> <blockquote id='x880' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x881' onclick='hideorshow("x881","x882")'>show</button></p> <blockquote id='x882' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x883' onclick='hideorshow("x883","x884")'>show</button></p> <blockquote id='x884' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x885' onclick='hideorshow("x885","x886")'>show</button></p> <blockquote id='x886' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x887' onclick='hideorshow("x887","x888")'>show</button></p> <blockquote id='x888' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#table-constraint">table-constraint:</a></b> <button id='x889' onclick='hideorshow("x889","x890")'>show</button></p> <blockquote id='x890' style='display:none;'> <img alt="syntax diagram table-constraint" src="images/syntax/table-constraint.gif" /> <p><b><a href="syntaxdiagrams.html#conflict-clause">conflict-clause:</a></b> <button id='x891' onclick='hideorshow("x891","x892")'>show</button></p> <blockquote id='x892' style='display:none;'> <img alt="syntax diagram conflict-clause" src="images/syntax/conflict-clause.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x893' onclick='hideorshow("x893","x894")'>show</button></p> <blockquote id='x894' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x895' onclick='hideorshow("x895","x896")'>show</button></p> <blockquote id='x896' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x897' onclick='hideorshow("x897","x898")'>show</button></p> <blockquote id='x898' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x899' onclick='hideorshow("x899","x900")'>show</button></p> <blockquote id='x900' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x901' onclick='hideorshow("x901","x902")'>show</button></p> <blockquote id='x902' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#foreign-key-clause">foreign-key-clause:</a></b> <button id='x903' onclick='hideorshow("x903","x904")'>show</button></p> <blockquote id='x904' style='display:none;'> <img alt="syntax diagram foreign-key-clause" src="images/syntax/foreign-key-clause.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#indexed-column">indexed-column:</a></b> <button id='x905' onclick='hideorshow("x905","x906")'>show</button></p> <blockquote id='x906' style='display:none;'> <img alt="syntax diagram indexed-column" src="images/syntax/indexed-column.gif" /> </blockquote> </blockquote> </blockquote> <p>The "CREATE TABLE" command is used to create a new table in an SQLite database. A CREATE TABLE command specifies the following attributes of the new table: <ul> <li><p>The name of the new table. <li><p> The database in which the new table is created. Tables may be created in the main database, the temp database, or in any attached database. <li><p> The name of each column in the table. <li><p> The declared type of each column in the table. <li><p> A default value or expression for each column in the table. <li><p> A default collation sequence to use with each column. <li><p> Optionally, a PRIMARY KEY for the table. Both single column and composite (multiple column) primary keys are supported. <li><p> A set of SQL constraints for each table. SQLite supports UNIQUE, NOT NULL, CHECK and FOREIGN KEY constraints. <li><p> Whether the table is a <a href="withoutrowid.html">WITHOUT ROWID</a> table. </ul> <p>Every CREATE TABLE statement must specify a name for the new table. Table names that begin with "sqlite_" are reserved for internal use. It is an error to attempt to create a table with a name that starts with "sqlite_". <p> If a <database-name> is specified, it must be either "main", "temp", or the name of an <a href="lang_attach.html">attached database</a>. In this case the new table is created in the named database. If the "TEMP" or "TEMPORARY" keyword occurs between the "CREATE" and "TABLE" then the new table is created in the temp database. It is an error to specify both a <database-name> and the TEMP or TEMPORARY keyword, unless the <database-name> is "temp". If no database name is specified and the TEMP keyword is not present then the table is created in the main database. <p> It is usually an error to attempt to create a new table in a database that already contains a table, index or view of the same name. However, if the "IF NOT EXISTS" clause is specified as part of the CREATE TABLE statement and a table or view of the same name already exists, the CREATE TABLE command simply has no effect (and no error message is returned). An error is still returned if the table cannot be created because of an existing index, even if the "IF NOT EXISTS" clause is specified. <p>It is not an error to create a table that has the same name as an existing <a href="lang_createtrigger.html">trigger</a>. <p>Tables are removed using the <a href="lang_droptable.html">DROP TABLE</a> statement. </p> <h3>CREATE TABLE ... AS SELECT Statements</h3> <p>A "CREATE TABLE ... AS SELECT" statement creates and populates a database table based on the results of a SELECT statement. The table has the same number of columns as the rows returned by the SELECT statement. The name of each column is the same as the name of the corresponding column in the result set of the SELECT statement. The declared type of each column is determined by the <a href="datatype3.html#expraff">expression affinity</a> of the corresponding expression in the result set of the SELECT statement, as follows: </p> <center><table border=1> <tr><th>Expression Affinity <th>Column Declared Type <tr><td>TEXT <td>"TEXT" <tr><td>NUMERIC <td>"NUM" <tr><td>INTEGER <td>"INT" <tr><td>REAL <td>"REAL" <tr><td>NONE <td>"" (empty string) </table></center> <p>A table created using CREATE TABLE AS has no PRIMARY KEY and no constraints of any kind. The default value of each column is NULL. The default collation sequence for each column of the new table is BINARY. <p>Tables created using CREATE TABLE AS are initially populated with the rows of data returned by the SELECT statement. Rows are assigned contiguously ascending <a href="lang_createtable.html#rowid">rowid</a> values, starting with 1, in the <a href="lang_select.html#orderby">order</a> that they are returned by the SELECT statement. <a name="tablecoldef"></a> <h3>Column Definitions</h3> <p>Unless it is a CREATE TABLE ... AS SELECT statement, a CREATE TABLE includes one or more <a href="syntaxdiagrams.html#column-def">column definitions</a>, optionally followed by a list of <a href="syntaxdiagrams.html#table-constraint">table constraints</a>. Each column definition consists of the name of the column, optionally followed by the declared type of the column, then one or more optional <a href="syntaxdiagrams.html#column-constraint">column constraints</a>. Included in the definition of "column constraints" for the purposes of the previous statement are the COLLATE and DEFAULT clauses, even though these are not really constraints in the sense that they do not restrict the data that the table may contain. The other constraints - NOT NULL, CHECK, UNIQUE, PRIMARY KEY and FOREIGN KEY constraints - impose restrictions on the tables data, and are are described under <a href="lang_createtable.html#constraints">SQL Data Constraints</a> below. <p>Unlike most SQL databases, SQLite does not restrict the type of data that may be inserted into a column based on the columns declared type. Instead, SQLite uses <a href="datatype3.html">dynamic typing</a>. The declared type of a column is used to determine the <a href="datatype3.html#affinity">affinity</a> of the column only. <p>The DEFAULT clause specifies a default value to use for the column if no value is explicitly provided by the user when doing an <a href="lang_insert.html">INSERT</a>. If there is no explicit DEFAULT clause attached to a column definition, then the default value of the column is NULL. An explicit DEFAULT clause may specify that the default value is NULL, a string constant, a blob constant, a signed-number, or any constant expression enclosed in parentheses. An explicit default value may also be one of the special case-independent keywords CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP. For the purposes of the DEFAULT clause, an expression is considered constant provided that it does not contain any sub-queries or string constants enclosed in double quotes. <p>Each time a row is inserted into the table by an INSERT statement that does not provide explicit values for all table columns the values stored in the new row are determined by their default values, as follows: <ul> <li><p>If the default value of the column is a constant NULL, text, blob or signed-number value, then that value is used directly in the new row. <li><p>If the default value of a column is an expression in parentheses, then the expression is evaluated once for each row inserted and the results used in the new row. <li><p>If the default value of a column is CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP, then the value used in the new row is a text representation of the current UTC date and/or time. For CURRENT_TIME, the format of the value is "HH:MM:SS". For CURRENT_DATE, "YYYY-MM-DD". The format for CURRENT_TIMESTAMP is "YYYY-MM-DD HH:MM:SS". </ul> <p>The COLLATE clause specifies the name of a <a href="datatype3.html#collation">collating sequence</a> to use as the default collation sequence for the column. If no COLLATE clause is specified, the default collation sequence is <a href="datatype3.html#collation">BINARY</a>. <p>The number of columns in a table is limited by the <a href="limits.html#max_column">SQLITE_MAX_COLUMN</a> compile-time parameter. A single row of a table cannot store more than <a href="limits.html#max_length">SQLITE_MAX_LENGTH</a> bytes of data. Both of these limits can be lowered at runtime using the <a href="c3ref/limit.html">sqlite3_limit()</a> C/C++ interface.</p> <a name="constraints"></a> <h3>SQL Data Constraints</h3> <a name="primkeyconst"></a> <p>Each table in SQLite may have at most one <b>PRIMARY KEY</b>. If the keywords PRIMARY KEY are added to a column definition, then the primary key for the table consists of that single column. Or, if a PRIMARY KEY clause is specified as a <a href="syntaxdiagrams.html#table-constraint">table-constraint</a>, then the primary key of the table consists of the list of columns specified as part of the PRIMARY KEY clause. An error is raised if more than one PRIMARY KEY clause appears in a CREATE TABLE statement. The PRIMARY KEY is optional for ordinary tables but is required for <a href="withoutrowid.html">WITHOUT ROWID</a> tables. <p>If a table has a single column primary key and the declared type of that column is "INTEGER" and the table is not a <a href="withoutrowid.html">WITHOUT ROWID</a> table, then the column is known as an <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a>. See below for a description of the special properties and behaviors associated with an <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a>. <p>Each row in a table with a primary key must have a unique combination of values in its primary key columns. For the purposes of determining the uniqueness of primary key values, NULL values are considered distinct from all other values, including other NULLs. If an <a href="lang_insert.html">INSERT</a> or <a href="lang_update.html">UPDATE</a> statement attempts to modify the table content so that two or more rows feature identical primary key values, it is a constraint violation. According to the SQL standard, PRIMARY KEY should always imply NOT NULL. Unfortunately, due to a bug in some early versions, this is not the case in SQLite. Unless the column is an <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a> or the table is a <a href="withoutrowid.html">WITHOUT ROWID</a> table or the column is declared NOT NULL, SQLite allows NULL values in a PRIMARY KEY column. SQLite could be fixed to conform to the standard, but doing so might break legacy applications. Hence, it has been decided to merely document the fact that SQLite allowing NULLs in most PRIMARY KEY columns. <a name="uniqueconst"></a> <p>A <b>UNIQUE</b> constraint is similar to a PRIMARY KEY constraint, except that a single table may have any number of UNIQUE constraints. For each UNIQUE constraint on the table, each row must contain a unique combination of values in the columns identified by the UNIQUE constraint. For the purposes of UNIQUE constraints, NULL values are considered distinct from all other values, including other NULLs. <p>In most cases, UNIQUE and PRIMARY KEY constraints are implemented by creating a unique index in the database. (The exceptions are <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a> and PRIMARY KEYs on <a href="withoutrowid.html">WITHOUT ROWID</a> tables.) Hence, the following schemas are logically equivalent: <ol> <li><p>CREATE TABLE t1(a, b UNIQUE); <li><p>CREATE TABLE t1(a, b PRIMARY KEY); <li><p>CREATE TABLE t1(a, b);<br> CREATE UNIQUE INDEX t1b ON t1(b); </ol> <a name="ckconst"></a> <p>A <b>CHECK</b> constraint may be attached to a column definition or specified as a table constraint. In practice it makes no difference. Each time a new row is inserted into the table or an existing row is updated, the expression associated with each CHECK constraint is evaluated and cast to a NUMERIC value in the same way as a <a href="lang_expr.html#castexpr">CAST expression</a>. If the result is zero (integer value 0 or real value 0.0), then a constraint violation has occurred. If the CHECK expression evaluates to NULL, or any other non-zero value, it is not a constraint violation. The expression of a CHECK constraint may not contain a subquery. <p>CHECK constraints have been supported since <a href="releaselog/3_3_0.html">version 3.3.0</a>. Prior to version 3.3.0, CHECK constraints were parsed but not enforced. <a name="notnullconst"></a> <p>A <b>NOT NULL</b> constraint may only be attached to a column definition, not specified as a table constraint. Not surprisingly, a NOT NULL constraint dictates that the associated column may not contain a NULL value. Attempting to set the column value to NULL when inserting a new row or updating an existing one causes a constraint violation. <p>Exactly how a constraint violation is dealt with is determined by the <a href="lang_conflict.html">constraint conflict resolution algorithm</a>. Each PRIMARY KEY, UNIQUE, NOT NULL and CHECK constraint has a default conflict resolution algorithm. PRIMARY KEY, UNIQUE and NOT NULL constraints may be explicitly assigned a default conflict resolution algorithm by including a <a href="syntaxdiagrams.html#conflict-clause">conflict-clause</a> in their definitions. Or, if a constraint definition does not include a <a href="syntaxdiagrams.html#conflict-clause">conflict-clause</a> or it is a CHECK constraint, the default conflict resolution algorithm is ABORT. Different constraints within the same table may have different default conflict resolution algorithms. See the section titled <a href="lang_conflict.html">ON CONFLICT</a> for additional information. <a name="rowid"></a> <h3>ROWIDs and the INTEGER PRIMARY KEY</h3> <p>Except for <a href="withoutrowid.html">WITHOUT ROWID</a> tables, all rows within SQLite tables have a 64-bit signed integer key that uniquely identifies the row within its table. This integer is usually called the "rowid". The rowid value can be accessed using one of the special case-independent names "rowid", "oid", or "_rowid_" in place of a column name. If a table contains a user defined column named "rowid", "oid" or "_rowid_", then that name always refers the explicitly declared column and cannot be used to retrieve the integer rowid value. <p>The rowid (and "oid" and "_rowid_") is omitted in <a href="withoutrowid.html">WITHOUT ROWID</a> tables. WITHOUT ROWID tables are only available in SQLite <a href="releaselog/3_8_2.html">version 3.8.2</a> and later. A table that lacks the WITHOUT ROWID clause is called a "rowid table". <p>The data for rowid tables is stored as a B-Tree structure containing one entry for each table row, using the rowid value as the key. This means that retrieving or sorting records by rowid is fast. Searching for a record with a specific rowid, or for all records with rowids within a specified range is around twice as fast as a similar search made by specifying any other PRIMARY KEY or indexed value. <p> With one exception noted below, if a rowid table has a primary key that consists of a single column and the declared type of that column is "INTEGER" in any mixture of upper and lower case, then the column becomes an alias for the rowid. Such a column is usually referred to as an "integer primary key". A PRIMARY KEY column only becomes an integer primary key if the declared type name is exactly "INTEGER". Other integer type names like "INT" or "BIGINT" or "SHORT INTEGER" or "UNSIGNED INTEGER" causes the primary key column to behave as an ordinary table column with integer <a href="datatype3.html#affinity">affinity</a> and a unique index, not as an alias for the rowid. <p> The exception mentioned above is that if the declaration of a column with declared type "INTEGER" includes an "PRIMARY KEY DESC" clause, it does not become an alias for the rowid and is not classified as an integer primary key. This quirk is not by design. It is due to a bug in early versions of SQLite. But fixing the bug could result in backwards incompatibilities. Hence, the original behavior has been retained (and documented) because behavior in a corner case is far better than a compatibility break. This means that the following three table declarations all cause the column "x" to be an alias for the rowid (an integer primary key): <ul> <li><tt>CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z);</tt> <li><tt>CREATE TABLE t(x INTEGER, y, z, PRIMARY KEY(x ASC));</tt> <li><tt>CREATE TABLE t(x INTEGER, y, z, PRIMARY KEY(x DESC));</tt> </ul> <p>But the following declaration does not result in "x" being an alias for the rowid: <ul> <li><tt>CREATE TABLE t(x INTEGER PRIMARY KEY DESC, y, z);</tt> </ul> <p>Rowid values may be modified using an UPDATE statement in the same way as any other column value can, either using one of the built-in aliases ("rowid", "oid" or "_rowid_") or by using an alias created by an integer primary key. Similarly, an INSERT statement may provide a value to use as the rowid for each row inserted. Unlike normal SQLite columns, an integer primary key or rowid column must contain integer values. Integer primary key or rowid columns are not able to hold floating point values, strings, BLOBs, or NULLs. <p>If an UPDATE statement attempts to set an integer primary key or rowid column to a NULL or blob value, or to a string or real value that cannot be losslessly converted to an integer, a "datatype mismatch" error occurs and the statement is aborted. If an INSERT statement attempts to insert a blob value, or a string or real value that cannot be losslessly converted to an integer into an integer primary key or rowid column, a "datatype mismatch" error occurs and the statement is aborted. <p>If an INSERT statement attempts to insert a NULL value into a rowid or integer primary key column, the system chooses an integer value to use as the rowid automatically. A detailed description of how this is done is provided <a href="autoinc.html">separately</a>.</p> <p>The <a href="foreignkeys.html#parentchild">parent key</a> of a <a href="foreignkeys.html">foreign key constraint</a> is not allowed to use the rowid. The parent key must used named columns only.</p> |
Changes to Doc/Extra/Core/lang_createtrigger.html.
|
| | | | | | < | > > > > | > > | > > > > > > > > > | > > > > > > > > > | < > | > > > > > | > > | > | < < > > > > > > > > > > > > > | < > > > > | > | | | > | > > > > > | | | < | < > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > | | < > > | > | | > > > > > | < > | | | | < | | | | | | | | | | | | | > > > > > > > > > > > > > > | | | | | | | | | < | > | | | | | | | | | > > > > > > > > > > > > > | | | | | | | | | | | | | | > > | > > > > > > > > | < > > > > | < < | < < < > | | < > | | | | | | > > > > | | < < < < < | > | | | | | | | > > > > > > > > > | | > | | | | | | | | > | | | | | | | | | | | > | > | | | | < < | | | | < < | | | | > > > > > | > > > > > > > > > > > > > > > > > > > > > | > | > > | > > > | | | | > > > > > | > | < > | > | < | < < > > | > | < > > | | > > | > | > | > | | > | | | > | > | | > > > > | | | | | > > | < < | | | > | < < | | | > | < | | > | > | > > | > > > | > > | > > | > | | | | < < < > | | | | < < < < < < < < < > | < > > > > | < < < < < < | | | | | | | | < | | > | > > > > > > | | | | | | | > > | | > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: CREATE TRIGGER</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>CREATE TRIGGER</h2><p><b><a href="syntaxdiagrams.html#create-trigger-stmt">create-trigger-stmt:</a></b> <button id='x907' onclick='hideorshow("x907","x908")'>hide</button></p> <blockquote id='x908'> <img alt="syntax diagram create-trigger-stmt" src="images/syntax/create-trigger-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#delete-stmt">delete-stmt:</a></b> <button id='x909' onclick='hideorshow("x909","x910")'>show</button></p> <blockquote id='x910' style='display:none;'> <img alt="syntax diagram delete-stmt" src="images/syntax/delete-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#qualified-table-name">qualified-table-name:</a></b> <button id='x911' onclick='hideorshow("x911","x912")'>show</button></p> <blockquote id='x912' style='display:none;'> <img alt="syntax diagram qualified-table-name" src="images/syntax/qualified-table-name.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#with-clause">with-clause:</a></b> <button id='x913' onclick='hideorshow("x913","x914")'>show</button></p> <blockquote id='x914' style='display:none;'> <img alt="syntax diagram with-clause" src="images/syntax/with-clause.gif" /> <p><b><a href="syntaxdiagrams.html#cte-table-name">cte-table-name:</a></b> <button id='x915' onclick='hideorshow("x915","x916")'>show</button></p> <blockquote id='x916' style='display:none;'> <img alt="syntax diagram cte-table-name" src="images/syntax/cte-table-name.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x917' onclick='hideorshow("x917","x918")'>show</button></p> <blockquote id='x918' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x919' onclick='hideorshow("x919","x920")'>show</button></p> <blockquote id='x920' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x921' onclick='hideorshow("x921","x922")'>show</button></p> <blockquote id='x922' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x923' onclick='hideorshow("x923","x924")'>show</button></p> <blockquote id='x924' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x925' onclick='hideorshow("x925","x926")'>show</button></p> <blockquote id='x926' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#insert-stmt">insert-stmt:</a></b> <button id='x927' onclick='hideorshow("x927","x928")'>show</button></p> <blockquote id='x928' style='display:none;'> <img alt="syntax diagram insert-stmt" src="images/syntax/insert-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#with-clause">with-clause:</a></b> <button id='x929' onclick='hideorshow("x929","x930")'>show</button></p> <blockquote id='x930' style='display:none;'> <img alt="syntax diagram with-clause" src="images/syntax/with-clause.gif" /> <p><b><a href="syntaxdiagrams.html#cte-table-name">cte-table-name:</a></b> <button id='x931' onclick='hideorshow("x931","x932")'>show</button></p> <blockquote id='x932' style='display:none;'> <img alt="syntax diagram cte-table-name" src="images/syntax/cte-table-name.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x933' onclick='hideorshow("x933","x934")'>show</button></p> <blockquote id='x934' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x935' onclick='hideorshow("x935","x936")'>show</button></p> <blockquote id='x936' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x937' onclick='hideorshow("x937","x938")'>show</button></p> <blockquote id='x938' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x939' onclick='hideorshow("x939","x940")'>show</button></p> <blockquote id='x940' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x941' onclick='hideorshow("x941","x942")'>show</button></p> <blockquote id='x942' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x943' onclick='hideorshow("x943","x944")'>show</button></p> <blockquote id='x944' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x945' onclick='hideorshow("x945","x946")'>show</button></p> <blockquote id='x946' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x947' onclick='hideorshow("x947","x948")'>show</button></p> <blockquote id='x948' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x949' onclick='hideorshow("x949","x950")'>show</button></p> <blockquote id='x950' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#update-stmt">update-stmt:</a></b> <button id='x951' onclick='hideorshow("x951","x952")'>show</button></p> <blockquote id='x952' style='display:none;'> <img alt="syntax diagram update-stmt" src="images/syntax/update-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#qualified-table-name">qualified-table-name:</a></b> <button id='x953' onclick='hideorshow("x953","x954")'>show</button></p> <blockquote id='x954' style='display:none;'> <img alt="syntax diagram qualified-table-name" src="images/syntax/qualified-table-name.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#with-clause">with-clause:</a></b> <button id='x955' onclick='hideorshow("x955","x956")'>show</button></p> <blockquote id='x956' style='display:none;'> <img alt="syntax diagram with-clause" src="images/syntax/with-clause.gif" /> <p><b><a href="syntaxdiagrams.html#cte-table-name">cte-table-name:</a></b> <button id='x957' onclick='hideorshow("x957","x958")'>show</button></p> <blockquote id='x958' style='display:none;'> <img alt="syntax diagram cte-table-name" src="images/syntax/cte-table-name.gif" /> </blockquote> </blockquote> </blockquote> </blockquote> <p>The CREATE TRIGGER statement is used to add triggers to the database schema. Triggers are database operations that are automatically performed when a specified database event occurs. </p> <p>A trigger may be specified to fire whenever a <a href="lang_delete.html">DELETE</a>, <a href="lang_insert.html">INSERT</a>, or <a href="lang_update.html">UPDATE</a> of a particular database table occurs, or whenever an <a href="lang_update.html">UPDATE</a> occurs on on one or more specified columns of a table.</p> <p>At this time SQLite supports only FOR EACH ROW triggers, not FOR EACH STATEMENT triggers. Hence explicitly specifying FOR EACH ROW is optional. FOR EACH ROW implies that the SQL statements specified in the trigger may be executed (depending on the WHEN clause) for each database row being inserted, updated or deleted by the statement causing the trigger to fire.</p> <p>Both the WHEN clause and the trigger actions may access elements of the row being inserted, deleted or updated using references of the form "NEW.<i>column-name</i>" and "OLD.<i>column-name</i>", where <i>column-name</i> is the name of a column from the table that the trigger is associated with. OLD and NEW references may only be used in triggers on events for which they are relevant, as follows:</p> <table border=0 cellpadding=10> <tr> <td valign="top" align="right" width=120><i>INSERT</i></td> <td valign="top">NEW references are valid</td> </tr> <tr> <td valign="top" align="right" width=120><i>UPDATE</i></td> <td valign="top">NEW and OLD references are valid</td> </tr> <tr> <td valign="top" align="right" width=120><i>DELETE</i></td> <td valign="top">OLD references are valid</td> </tr> </table> </p> <p>If a WHEN clause is supplied, the SQL statements specified are only executed for rows for which the WHEN clause is true. If no WHEN clause is supplied, the SQL statements are executed for all rows.</p> <p>The BEFORE or AFTER keyword determines when the trigger actions will be executed relative to the insertion, modification or removal of the associated row.</p> <p>An <a href="lang_conflict.html">ON CONFLICT</a> clause may be specified as part of an <a href="lang_update.html">UPDATE</a> or <a href="lang_insert.html">INSERT</a> action within the body of the trigger. However if an <a href="lang_conflict.html">ON CONFLICT</a> clause is specified as part of the statement causing the trigger to fire, then conflict handling policy of the outer statement is used instead.</p> <p>Triggers are automatically <a href="lang_droptrigger.html">dropped</a> when the table that they are associated with (the <i>table-name</i> table) is <a href="lang_droptable.html">dropped</a>. However if the trigger actions reference other tables, the trigger is not dropped or modified if those other tables are <a href="lang_droptable.html">dropped</a> or <a href="lang_altertable.html">modified</a>.</p> <p>Triggers are removed using the <a href="lang_droptrigger.html">DROP TRIGGER</a> statement.</p> <h3>Syntax Restrictions On UPDATE, DELETE, and INSERT Statements Within Triggers</h3> <p>The <a href="lang_update.html">UPDATE</a>, <a href="lang_delete.html">DELETE</a>, and <a href="lang_insert.html">INSERT</a> statements within triggers do not support the full syntax for <a href="lang_update.html">UPDATE</a>, <a href="lang_delete.html">DELETE</a>, and <a href="lang_insert.html">INSERT</a> statements. The following restrictions apply:</p> <ul> <li><p> The name of the table to be modified in an <a href="lang_update.html">UPDATE</a>, <a href="lang_delete.html">DELETE</a>, or <a href="lang_insert.html">INSERT</a> statement must be an unqualified table name. In other words, one must use just "<i>tablename</i>" not "<i>database</i><b>.</b><i>tablename</i>" when specifying the table. The table to be modified must exist in the same database as the table or view to which the trigger is attached. </p></li> <li><p> The "INSERT INTO <i>table</i> DEFAULT VALUES" form of the <a href="lang_insert.html">INSERT</a> statement is not supported. </p></li> <li><p> The INDEXED BY and NOT INDEXED clauses are not supported for <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements. </p></li> <li><p> The ORDER BY and LIMIT clauses on <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements are not supported. ORDER BY and LIMIT are not normally supported for <a href="lang_update.html">UPDATE</a> or <a href="lang_delete.html">DELETE</a> in any context but can be enabled for top-level statements using the <a href="compile.html#enable_update_delete_limit">SQLITE_ENABLE_UPDATE_DELETE_LIMIT</a> compile-time option. However, that compile-time option only applies to top-level <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements, not <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements within triggers. </p></li> </ul> <a name="instead_of_trigger"></a> <h3>INSTEAD OF trigger</h3> <p>Triggers may be created on <a href="lang_createview.html">views</a>, as well as ordinary tables, by specifying INSTEAD OF in the CREATE TRIGGER statement. If one or more ON INSERT, ON DELETE or ON UPDATE triggers are defined on a view, then it is not an error to execute an INSERT, DELETE or UPDATE statement on the view, respectively. Instead, executing an INSERT, DELETE or UPDATE on the view causes the associated triggers to fire. The real tables underlying the view are not modified (except possibly explicitly, by a trigger program).</p> <p>Note that the <a href="c3ref/changes.html">sqlite3_changes()</a> and <a href="c3ref/total_changes.html">sqlite3_total_changes()</a> interfaces do not count INSTEAD OF trigger firings, but the <a href="pragma.html#pragma_count_changes">count_changes pragma</a> does count INSTEAD OF trigger firing.</p> <h3>Examples</h3> <p>Assuming that customer records are stored in the "customers" table, and that order records are stored in the "orders" table, the following trigger ensures that all associated orders are redirected when a customer changes his or her address:</p> <blockquote><pre> CREATE TRIGGER update_customer_address UPDATE OF address ON customers BEGIN UPDATE orders SET address = new.address WHERE customer_name = old.name; END; </pre></blockquote> <p>With this trigger installed, executing the statement:</p> <blockquote><pre> UPDATE customers SET address = '1 Main St.' WHERE name = 'Jack Jones'; </pre></blockquote> <p>causes the following to be automatically executed:</p> <blockquote><pre> UPDATE orders SET address = '1 Main St.' WHERE customer_name = 'Jack Jones'; </pre></blockquote> <a name="undef_before"></a> <h3>Cautions On The Use Of BEFORE triggers</h3> <p>If a BEFORE UPDATE or BEFORE DELETE trigger modifies or deletes a row that was to have been updated or deleted, then the result of the subsequent update or delete operation is undefined. Furthermore, if a BEFORE trigger modifies or deletes a row, then it is undefined whether or not AFTER triggers that would have otherwise run on those rows will in fact run. </p> <p>The value of NEW.rowid is undefined in a BEFORE INSERT trigger in which the rowid is not explicitly set to an integer.</p> <p>Because of the behaviors described above, programmers are encouraged to prefer AFTER triggers over BEFORE triggers.</p> <h3>The RAISE() function</h3> <p>A special SQL function RAISE() may be used within a trigger-program, with the following syntax</p> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b></p><blockquote> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif"></img> </blockquote> <p>When one of RAISE(ROLLBACK,...), RAISE(ABORT,...) or RAISE(FAIL,...) is called during trigger-program execution, the specified <a href="lang_conflict.html">ON CONFLICT</a> processing is performed the current query terminates. An error code of <a href="c3ref/c_abort.html">SQLITE_CONSTRAINT</a> is returned to the application, along with the specified error message.</p> <p>When RAISE(IGNORE) is called, the remainder of the current trigger program, the statement that caused the trigger program to execute and any subsequent trigger programs that would have been executed are abandoned. No database changes are rolled back. If the statement that caused the trigger program to execute is itself part of a trigger program, then that trigger program resumes execution at the beginning of the next step. </p> <a name="temptrig"></a> <h3>TEMP Triggers on Non-TEMP Tables</h3> <p>A trigger normally exists in the same database as the table named after the "ON" keyword in the CREATE TRIGGER statement. Except, it is possible to create a TEMP TRIGGER on a table in another database. Such a trigger will only fire when changes are made to the target table by the application that defined the trigger. Other applications that modify the database will not be able to see the TEMP trigger and hence cannot run the trigger.</p> <p>When defining a TEMP trigger on a non-TEMP table, it is important to specify the database holding the non-TEMP table. For example, in the following statement, it is important to say "main.tab1" instead of just "tab1":</p> <blockquote><pre> CREATE TEMP TRIGGER ex1 AFTER INSERT ON <b>main.</b>tab1 BEGIN ... </pre></blockquote> <p>Failure to specify the database name on the target table could result in the TEMP trigger being reattached to a table with the same name in another database whenever any schema change occurs.</p> |
Changes to Doc/Extra/Core/lang_createview.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > > > > > > > | | < < > | < | > > > > | > > > > | < < > > > > > > > > > > > > > > > > > > | > | | | > | > | < < | > > | > | | > > > > > | | < < | > > | > > > > > > > > > > > > > > > > > > | > | < < < < | > | < > | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > | > > > > > > > > | > > > > > | < < > > > > > > > | | < < < > | | | | | > > > | < | < > > > | | > > > > | > > > > > > > > > | | | | | > > > > | | > > > > | > > > > > | > > > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: CREATE VIEW</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>CREATE VIEW</h2><p><b><a href="syntaxdiagrams.html#create-view-stmt">create-view-stmt:</a></b> <button id='x959' onclick='hideorshow("x959","x960")'>hide</button></p> <blockquote id='x960'> <img alt="syntax diagram create-view-stmt" src="images/syntax/create-view-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x961' onclick='hideorshow("x961","x962")'>show</button></p> <blockquote id='x962' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x963' onclick='hideorshow("x963","x964")'>show</button></p> <blockquote id='x964' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x965' onclick='hideorshow("x965","x966")'>show</button></p> <blockquote id='x966' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x967' onclick='hideorshow("x967","x968")'>show</button></p> <blockquote id='x968' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x969' onclick='hideorshow("x969","x970")'>show</button></p> <blockquote id='x970' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x971' onclick='hideorshow("x971","x972")'>show</button></p> <blockquote id='x972' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x973' onclick='hideorshow("x973","x974")'>show</button></p> <blockquote id='x974' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x975' onclick='hideorshow("x975","x976")'>show</button></p> <blockquote id='x976' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x977' onclick='hideorshow("x977","x978")'>show</button></p> <blockquote id='x978' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x979' onclick='hideorshow("x979","x980")'>show</button></p> <blockquote id='x980' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x981' onclick='hideorshow("x981","x982")'>show</button></p> <blockquote id='x982' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x983' onclick='hideorshow("x983","x984")'>show</button></p> <blockquote id='x984' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x985' onclick='hideorshow("x985","x986")'>show</button></p> <blockquote id='x986' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x987' onclick='hideorshow("x987","x988")'>show</button></p> <blockquote id='x988' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> </blockquote> <p>The CREATE VIEW command assigns a name to a pre-packaged <a href="lang_select.html">SELECT</a> statement. Once the view is created, it can be used in the FROM clause of another <a href="lang_select.html">SELECT</a> in place of a table name. </p> <p>If the "TEMP" or "TEMPORARY" keyword occurs in between "CREATE" and "VIEW" then the view that is created is only visible to the process that opened the database and is automatically deleted when the database is closed.</p> <p> If a <database-name> is specified, then the view is created in the named database. It is an error to specify both a <database-name> and the TEMP keyword on a VIEW, unless the <database-name> is "temp". If no database name is specified, and the TEMP keyword is not present, the VIEW is created in the main database.</p> <p>You cannot <a href="lang_delete.html">DELETE</a>, <a href="lang_insert.html">INSERT</a>, or <a href="lang_update.html">UPDATE</a> a view. Views are read-only in SQLite. However, in many cases you can use an <a href="lang_createtrigger.html#instead_of_trigger">INSTEAD OF trigger</a> on the view to accomplish the same thing. Views are removed with the <a href="lang_dropview.html">DROP VIEW</a> command.</p> |
Changes to Doc/Extra/Core/lang_createvtab.html.
|
| | | | | | < | > > | > | > > | > | < | < | < > | | > > | > | < < > > > > > > | > > | > > > > > | | | | | | > | < | > > > > > > > > > > | > > > | | | | | | | | | | | > > | < > | > > > > > > > > | | < > > > > | > > > > > > > > > > > > > > > > > > > > > > > | < < < < < < < < < > > > > > | > > | > > > > > > > > > | | > | | | | | < < < < < < < < < > > > > > > > > > > > | > | | | | > | | | < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: CREATE VIRTUAL TABLE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>CREATE VIRTUAL TABLE</h2><p><b><a href="syntaxdiagrams.html#create-virtual-table-stmt">create-virtual-table-stmt:</a></b> <button id='x989' onclick='hideorshow("x989","x990")'>hide</button></p> <blockquote id='x990'> <img alt="syntax diagram create-virtual-table-stmt" src="images/syntax/create-virtual-table-stmt.gif" /> </blockquote> <p>A <a href="vtab.html">virtual table</a> is an interface to an external storage or computation engine that appears to be a table but does not actually store information in the database file.</p> <p>In general, you can do anything with a <a href="vtab.html">virtual table</a> that can be done with an ordinary table, except that you cannot create indices or triggers on a virtual table. Some virtual table implementations might impose additional restrictions. For example, many virtual tables are read-only.</p> <p>The <module-name> is the name of an object that implements the virtual table. The <module-name> must be registered with the SQLite database connection using <a href="c3ref/create_module.html">sqlite3_create_module()</a> or <a href="c3ref/create_module.html">sqlite3_create_module_v2()</a> prior to issuing the CREATE VIRTUAL TABLE statement. The module takes zero or more comma-separated arguments. The arguments can be just about any text as long as it has balanced parentheses. The argument syntax is sufficiently general that the arguments can be made to appear as <a href="lang_createtable.html#tablecoldef">column definitions</a> in a traditional <a href="lang_createtable.html">CREATE TABLE</a> statement. SQLite passes the module arguments directly to the <a href="vtab.html#xcreate">xCreate</a> and <a href="vtab.html#xconnect">xConnect</a> methods of the module implementation without any interpretation. It is the responsibility of the module implementation to parse and interpret its own arguments.</p> <p>A virtual table is destroyed using the ordinary <a href="lang_droptable.html">DROP TABLE</a> statement. There is no DROP VIRTUAL TABLE statement.</p> |
Added Doc/Extra/Core/lang_datefunc.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: Date And Time Functions</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>Date And Time Functions</h2> <p> SQLite supports five date and time functions as follows: </p> <p> <ol> <li> <b>date(</b><i>timestring, modifier, modifier, ...</i><b>)</b> </li> <li> <b>time(</b><i>timestring, modifier, modifier, ...</i><b>)</b> </li> <li> <b>datetime(</b><i>timestring, modifier, modifier, ...</i><b>)</b> </li> <li> <b>julianday(</b><i>timestring, modifier, modifier, ...</i><b>)</b> </li> <li> <b>strftime(</b><i>format, timestring, modifier, modifier, ...</i><b>)</b> </li> </ol> <p> All five date and time functions take a time string as an argument. The time string is followed by zero or more modifiers. The strftime() function also takes a format string as its first argument. </p> <p> The date and time functions use a subset of <a href="http://en.wikipedia.org/wiki/ISO_8601">IS0-8601</a> date and time formats. The date() function returns the date in this format: YYYY-MM-DD. The time() function returns the time as HH:MM:SS. The datetime() function returns "YYYY-MM-DD HH:MM:SS". The julianday() function returns the <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> - the number of days since noon in Greenwich on November 24, 4714 B.C. (<a href="http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">Proleptic Gregorian calendar</a>). The strftime() routine returns the date formatted according to the format string specified as the first argument. The format string supports the most common substitutions found in the <a href="http://opengroup.org/onlinepubs/007908799/xsh/strftime.html">strftime() function</a> from the standard C library plus two new substitutions, %f and %J. The following is a complete list of valid strftime() substitutions: </p> <blockquote> <table border="0" cellpadding="0" cellspacing="0"> <tr><td><td width="10"><td></tr> <tr><td> %d <td><td> day of month: 00 <tr><td> %f <td><td> fractional seconds: SS.SSS <tr><td> %H <td><td> hour: 00-24 <tr><td> %j <td><td> day of year: 001-366 <tr><td> %J <td><td> Julian day number <tr><td> %m <td><td> month: 01-12 <tr><td> %M <td><td> minute: 00-59 <tr><td> %s <td><td> seconds since 1970-01-01 <tr><td> %S <td><td> seconds: 00-59 <tr><td> %w <td><td> day of week 0-6 with Sunday==0 <tr><td> %W <td><td> week of year: 00-53 <tr><td> %Y <td><td> year: 0000-9999 <tr><td> %% <td><td> % </table> </blockquote> <p> Notice that all other date and time functions can be expressed in terms of strftime(): </p> <blockquote> <table border="0" cellpadding="0" cellspacing="0"> <tr><td><b>Function</b><td width="30"><td><b>Equivalent strftime()</b> <tr><td> date(...) <td><td> strftime('%Y-%m-%d', ...) <tr><td> time(...) <td><td> strftime('%H:%M:%S', ...) <tr><td> datetime(...) <td><td> strftime('%Y-%m-%d %H:%M:%S', ...) <tr><td> julianday(...) <td><td> strftime('%J', ...) </table> </blockquote> <p> The only reasons for providing functions other than strftime() is for convenience and for efficiency. </p> <h3>Time Strings</h3> <p>A time string can be in any of the following formats:</p> <ol> <li> <i>YYYY-MM-DD</i> <li> <i>YYYY-MM-DD HH:MM</i> <li> <i>YYYY-MM-DD HH:MM:SS</i> <li> <i>YYYY-MM-DD HH:MM:SS.SSS</i> <li> <i>YYYY-MM-DD</i><b>T</b><i>HH:MM</i> <li> <i>YYYY-MM-DD</i><b>T</b><i>HH:MM:SS</i> <li> <i>YYYY-MM-DD</i><b>T</b><i>HH:MM:SS.SSS</i> <li> <i>HH:MM</i> <li> <i>HH:MM:SS</i> <li> <i>HH:MM:SS.SSS</i> <li> <b>now</b> <li> <i>DDDDDDDDDD</i> </ol> <p> In formats 5 through 7, the "T" is a literal character separating the date and the time, as required by <a href="http://www.w3c.org/TR/NOTE-datetime">ISO-8601</a>. Formats 8 through 10 that specify only a time assume a date of 2000-01-01. Format 11, the string 'now', is converted into the current date and time as obtained from the xCurrentTime method of the <a href="c3ref/vfs.html">sqlite3_vfs</a> object in use. The 'now' argument to date and time functions always returns exactly the same value for multiple invocations within the same <a href="c3ref/step.html">sqlite3_step()</a> call. <a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">Universal Coordinated Time (UTC)</a> is used. Format 12 is the <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day number</a> expressed as a floating point value. </p> <p> Formats 2 through 10 may be optionally followed by a timezone indicator of the form "<i>[+-]HH:MM</i>" or just "<i>Z</i>". The date and time functions use UTC or "zulu" time internally, and so the "Z" suffix is a no-op. Any non-zero "HH:MM" suffix is subtracted from the indicated date and time in order to compute zulu time. For example, all of the following time strings are equivalent: </p> <blockquote> 2013-10-07 08:23:19.120<br> 2013-10-07T08:23:19.120Z<br> 2013-10-07 08:23:19.120-04:00<br> 2456572.84952685 </blockquote> <p> In formats 4, 7, and 10, the fractional seconds value SS.SSS can have one or more digits following the decimal point. Exactly three digits are shown in the examples because only the first three digits are significant to the result, but the input string can have fewer or more than three digits and the date/time functions will still operate correctly. Similarly, format 12 is shown with 10 significant digits, but the date/time functions will really accept as many or as few digits as are necessary to represent the Julian day number. </p> <h3>Modifiers</h3> <p>The time string can be followed by zero or more modifiers that alter date and/or time. Each modifier is a transformation that is applied to the time value to its left. Modifiers are applied from left to right; order is important. The available modifiers are as follows.</p> <ol> <li> NNN days <li> NNN hours <li> NNN minutes <li> NNN.NNNN seconds <li> NNN months <li> NNN years <li> start of month <li> start of year <li> start of day <li> weekday N <li> unixepoch <li> localtime <li> utc </ol> <p>The first six modifiers (1 through 6) simply add the specified amount of time to the date and time specified by the preceding timestring and modifiers. Note that "±NNN months" works by rendering the original date into the YYYY-MM-DD format, adding the ±NNN to the MM month value, then normalizing the result. Thus, for example, the data 2001-03-31 modified by '+1 month' initially yields 2001-04-31, but April only has 30 days so the date is normalized to 2001-05-01. A similar effect occurs when the original date is February 29 of a leapyear and the modifier is ±N years where N is not a multiple of four.</p> <p>The "start of" modifiers (7 through 9) shift the date backwards to the beginning of the current month, year or day.</p> <p>The "weekday" modifier advances the date forward to the next date where the weekday number is N. Sunday is 0, Monday is 1, and so forth.</p> <p>The "unixepoch" modifier (11) only works if it immediately follows a timestring in the DDDDDDDDDD format. This modifier causes the DDDDDDDDDD to be interpreted not as a Julian day number as it normally would be, but as <a href="http://en.wikipedia.org/wiki/Unix_time">Unix Time</a> - the number of seconds since 1970. If the "unixepoch" modifier does not follow a timestring of the form DDDDDDDDDD which expresses the number of seconds since 1970 or if other modifiers separate the "unixepoch" modifier from prior DDDDDDDDDD then the behavior is undefined. Due to precision limitations imposed by the implementations use of 64-bit integers, the "unixepoch" modifier only works for dates between 0000-01-01 00:00:00 and 5352-11-01 10:52:47 (unix times of -62167219200 through 10675199167).</p> <p>The "localtime" modifier (12) assumes the time string to its left is in Universal Coordinated Time (UTC) and adjusts the time string so that it displays localtime. If "localtime" follows a time that is not UTC, then the behavior is undefined. The "utc" is the opposite of "localtime". "utc" assumes that the string to its left is in the local timezone and adjusts that string to be in UTC. If the prior string is not in localtime, then the result of "utc" is undefined.</p> <h3>Examples</h3> <p>Compute the current date.<p> <blockquote>SELECT date('now');</blockquote> <p>Compute the last day of the current month.</p> <blockquote>SELECT date('now','start of month','+1 month','-1 day'); </blockquote> <p>Compute the date and time given a unix timestamp 1092941466.</p> <blockquote> SELECT datetime(1092941466, 'unixepoch'); </blockquote> <p>Compute the date and time given a unix timestamp 1092941466, and compensate for your local timezone.</p> <blockquote> SELECT datetime(1092941466, 'unixepoch', 'localtime'); </blockquote> <p>Compute the current unix timestamp.</p> <blockquote> SELECT strftime('%s','now'); </blockquote> <p>Compute the number of days since the signing of the US Declaration of Independence.</p> <blockquote> SELECT julianday('now') - julianday('1776-07-04'); </blockquote> <p>Compute the number of seconds since a particular moment in 2004:</p> <blockquote> SELECT strftime('%s','now') - strftime('%s','2004-01-01 02:34:56'); </blockquote> <p> Compute the date of the first Tuesday in October for the current year. </p> <blockquote> SELECT date('now','start of year','+9 months','weekday 2'); </blockquote> <p>Compute the time since the unix epoch in seconds (like strftime('%s','now') except includes fractional part):</p> <blockquote> SELECT (julianday('now') - 2440587.5)*86400.0; </blockquote> <h3>Caveats And Bugs</h3> <p>The computation of local time depends heavily on the whim of politicians and is thus difficult to get correct for all locales. In this implementation, the standard C library function localtime_r() is used to assist in the calculation of local time. The localtime_r() C function normally only works for years between 1970 and 2037. For dates outside this range, SQLite attempts to map the year into an equivalent year within this range, do the calculation, then map the year back.</p> <p>These functions only work for dates between 0000-01-01 00:00:00 and 9999-12-31 23:59:59 (julidan day numbers 1721059.5 through 5373484.5). For dates outside that range, the results of these functions are undefined.</p> <p>Non-Vista Windows platforms only support one set of DST rules. Vista only supports two. Therefore, on these platforms, historical DST calculations will be incorrect. For example, in the US, in 2007 the DST rules changed. Non-Vista Windows platforms apply the new 2007 DST rules to all previous years as well. Vista does somewhat better getting results correct back to 1986, when the rules were also changed.</p> <p>All internal computations assume the <a href="http://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian calendar</a> system. It is also assumed that every day is exactly 86400 seconds in duration.</p> |
Deleted Doc/Extra/Core/lang_datetime.html.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to Doc/Extra/Core/lang_delete.html.
|
| | | | | | < | > > > > | > > | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > | | | > > > | > | | > > | | | > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > | | | > | < < > > > | > > | | > > > > | > > | < > | > > > > > > > > | > > > > | > > > > > > > > | > > > > | | > > > > > > > | > > > > | < < > | | > > > > > > > > | | | < > > > > > > > > > > > > > > > > > > > > > > > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | < > > > | > | > > | > > > > > > > > > > > > | > > > > > | | > | > > > | > > > | | > > > > > > > > > | > > > > > > > > | > > > > | > > > | > | | | > > > > > > > > > > > | > > > | > > > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: DELETE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>DELETE</h2><p><b><a href="syntaxdiagrams.html#delete-stmt">delete-stmt:</a></b> <button id='x991' onclick='hideorshow("x991","x992")'>hide</button></p> <blockquote id='x992'> <img alt="syntax diagram delete-stmt" src="images/syntax/delete-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x993' onclick='hideorshow("x993","x994")'>show</button></p> <blockquote id='x994' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x995' onclick='hideorshow("x995","x996")'>show</button></p> <blockquote id='x996' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x997' onclick='hideorshow("x997","x998")'>show</button></p> <blockquote id='x998' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x999' onclick='hideorshow("x999","x1000")'>show</button></p> <blockquote id='x1000' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1001' onclick='hideorshow("x1001","x1002")'>show</button></p> <blockquote id='x1002' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1003' onclick='hideorshow("x1003","x1004")'>show</button></p> <blockquote id='x1004' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1005' onclick='hideorshow("x1005","x1006")'>show</button></p> <blockquote id='x1006' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1007' onclick='hideorshow("x1007","x1008")'>show</button></p> <blockquote id='x1008' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1009' onclick='hideorshow("x1009","x1010")'>show</button></p> <blockquote id='x1010' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1011' onclick='hideorshow("x1011","x1012")'>show</button></p> <blockquote id='x1012' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1013' onclick='hideorshow("x1013","x1014")'>show</button></p> <blockquote id='x1014' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1015' onclick='hideorshow("x1015","x1016")'>show</button></p> <blockquote id='x1016' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1017' onclick='hideorshow("x1017","x1018")'>show</button></p> <blockquote id='x1018' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1019' onclick='hideorshow("x1019","x1020")'>show</button></p> <blockquote id='x1020' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#qualified-table-name">qualified-table-name:</a></b> <button id='x1021' onclick='hideorshow("x1021","x1022")'>show</button></p> <blockquote id='x1022' style='display:none;'> <img alt="syntax diagram qualified-table-name" src="images/syntax/qualified-table-name.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#with-clause">with-clause:</a></b> <button id='x1023' onclick='hideorshow("x1023","x1024")'>show</button></p> <blockquote id='x1024' style='display:none;'> <img alt="syntax diagram with-clause" src="images/syntax/with-clause.gif" /> <p><b><a href="syntaxdiagrams.html#cte-table-name">cte-table-name:</a></b> <button id='x1025' onclick='hideorshow("x1025","x1026")'>show</button></p> <blockquote id='x1026' style='display:none;'> <img alt="syntax diagram cte-table-name" src="images/syntax/cte-table-name.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1027' onclick='hideorshow("x1027","x1028")'>show</button></p> <blockquote id='x1028' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1029' onclick='hideorshow("x1029","x1030")'>show</button></p> <blockquote id='x1030' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1031' onclick='hideorshow("x1031","x1032")'>show</button></p> <blockquote id='x1032' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1033' onclick='hideorshow("x1033","x1034")'>show</button></p> <blockquote id='x1034' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1035' onclick='hideorshow("x1035","x1036")'>show</button></p> <blockquote id='x1036' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1037' onclick='hideorshow("x1037","x1038")'>show</button></p> <blockquote id='x1038' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1039' onclick='hideorshow("x1039","x1040")'>show</button></p> <blockquote id='x1040' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1041' onclick='hideorshow("x1041","x1042")'>show</button></p> <blockquote id='x1042' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1043' onclick='hideorshow("x1043","x1044")'>show</button></p> <blockquote id='x1044' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> </blockquote> </blockquote> <p>The DELETE command removes records from the table identified by the <i>qualified-table-name</i>. <p>If the WHERE clause is not present, all records in the table are deleted. If a WHERE clause is supplied, then only those rows for which the result of evaluating the WHERE clause as a <a href="lang_expr.html#booleanexpr">boolean expression is true</a> are deleted. <h3>Restrictions on DELETE Statements Within CREATE TRIGGER</h3> <p>The following restrictions apply to DELETE statements that occur within the body of a <a href="lang_createtrigger.html">CREATE TRIGGER</a> statement: <ul> <li><p>The <i>table-name</i> specified as part of a DELETE statement within a trigger body must be unqualified. In other words, the <i>database-name</i><b>.</b> prefix on the table name is not allowed within triggers. If the table to which the trigger is attached is not in the temp database, then DELETE statements within the trigger body must operate on tables within the same database as it. If the table to which the trigger is attached is in the TEMP database, then the unqualified name of the table being deleted is resolved in the same way as it is for a top-level statement (by searching first the TEMP database, then the main database, then any other databases in the order they were attached). <li><p>The INDEXED BY and NOT INDEXED clauses are not allowed on DELETE statements within triggers.</p> <li><p>The LIMIT and ORDER BY clauses (described below) are unsupported for DELETE statements within triggers.</p> </ul> <h3>Optional LIMIT and ORDER BY clauses</h3> <p>If SQLite is compiled with the <a href="compile.html#enable_update_delete_limit">SQLITE_ENABLE_UPDATE_DELETE_LIMIT</a> compile-time option, then the syntax of the DELETE statement is extended by the addition of optional ORDER BY and LIMIT clauses:</p> <p><b><a href="syntaxdiagrams.html#delete-stmt-limited">delete-stmt-limited:</a></b></p><blockquote> <img alt="syntax diagram delete-stmt-limited" src="images/syntax/delete-stmt-limited.gif"></img> </blockquote> <p>If a DELETE statement has a LIMIT clause, the maximum number of rows that will be deleted is found by evaluating the accompanying expression and casting it to an integer value. If the result of the evaluating the LIMIT clause cannot be losslessly converted to an integer value, it is an error. A negative LIMIT value is interpreted as "no limit". If the DELETE statement also has an OFFSET clause, then it is similarly evaluated and cast to an integer value. Again, it is an error if the value cannot be losslessly converted to an integer. If there is no OFFSET clause, or the calculated integer value is negative, the effective OFFSET value is zero. <p>If the DELETE statement has an ORDER BY clause, then all rows that would be deleted in the absence of the LIMIT clause are sorted according to the ORDER BY. The first <i>M</i> rows, where <i>M</i> is the value found by evaluating the OFFSET clause expression, are skipped, and the following <i>N</i>, where <i>N</i> is the value of the LIMIT expression, are deleted. If there are less than <i>N</i> rows remaining after taking the OFFSET clause into account, or if the LIMIT clause evaluated to a negative value, then all remaining rows are deleted. <p>If the DELETE statement has no ORDER BY clause, then all rows that would be deleted in the absence of the LIMIT clause are assembled in an arbitrary order before applying the LIMIT and OFFSET clauses to determine the subset that are actually deleted. <p>The ORDER BY clause on a DELETE statement is used only to determine which rows fall within the LIMIT. The order in which rows are deleted is arbitrary and is not influenced by the ORDER BY clause. <a name="truncateopt"></a> <h3>The Truncate Optimization</h3> <p>When the WHERE is omitted from a DELETE statement and the table being deleted has no triggers, SQLite uses an optimization to erase the entire table content without having to visit each row of the table individually. This "truncate" optimization makes the delete run much faster. Prior to SQLite <a href="releaselog/3_6_5.html">version 3.6.5</a>, the truncate optimization also meant that the <a href="c3ref/changes.html">sqlite3_changes()</a> and <a href="c3ref/total_changes.html">sqlite3_total_changes()</a> interfaces and the <a href="pragma.html#pragma_count_changes">count_changes pragma</a> will not actually return the number of deleted rows. That problem has been fixed as of <a href="releaselog/3_6_5.html">version 3.6.5</a>. <p>The truncate optimization can be permanently disabled for all queries by recompiling SQLite with the <a href="compile.html#omit_truncate_optimization">SQLITE_OMIT_TRUNCATE_OPTIMIZATION</a> compile-time switch.</p> <p>The truncate optimization can also be disabled at runtime using the <a href="c3ref/set_authorizer.html">sqlite3_set_authorizer()</a> interface. If an authorizer callback returns <a href="c3ref/c_deny.html">SQLITE_IGNORE</a> for an <a href="c3ref/c_alter_table.html">SQLITE_DELETE</a> action code, then the DELETE operation will proceed but the truncate optimization will be bypassed and rows will be deleted one by one.</p> |
Changes to Doc/Extra/Core/lang_detach.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < | < > | | | | | | | | | > | < | > > > > > > > > > > | > > > | | | | | > > | > > > | | | | | | | | | | | | | < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > > > > > > > | > > | | > > > | | | | | < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: DETACH DATABASE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>DETACH DATABASE</h2><p><b><a href="syntaxdiagrams.html#detach-stmt">detach-stmt:</a></b> <button id='x1045' onclick='hideorshow("x1045","x1046")'>hide</button></p> <blockquote id='x1046'> <img alt="syntax diagram detach-stmt" src="images/syntax/detach-stmt.gif" /> </blockquote> <p>This statement detaches an additional database connection previously attached using the <a href="lang_attach.html">ATTACH</a> statement. When not in <a href="sharedcache.html">shared cache mode</a>, it is possible to have the same database file attached multiple times using different names, and detaching one connection to a file will leave the others intact.</p> In <a href="sharedcache.html">shared cache mode</a>, attempting to attach the same database file more than once results in an error. <p>This statement will fail if SQLite is in the middle of a transaction.</p> |
Changes to Doc/Extra/Core/lang_dropindex.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < | > | | | | | | | | | | | | | > > > > > > > > > | > > > | | | | | | | | | | | | | | | | | | | | | | < | | | | > | > > > > > > > > > > > > > > > | | | | | | | < < > | > | < | > | | > > | | > | | | > > > > > | > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: DROP INDEX</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>DROP INDEX</h2><p><b><a href="syntaxdiagrams.html#drop-index-stmt">drop-index-stmt:</a></b> <button id='x1047' onclick='hideorshow("x1047","x1048")'>hide</button></p> <blockquote id='x1048'> <img alt="syntax diagram drop-index-stmt" src="images/syntax/drop-index-stmt.gif" /> </blockquote> <p>The DROP INDEX statement removes an index added with the <a href="lang_createindex.html">CREATE INDEX</a> statement. The index is completely removed from the disk. The only way to recover the index is to reenter the appropriate <a href="lang_createindex.html">CREATE INDEX</a> command.</p> |
Changes to Doc/Extra/Core/lang_droptable.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < | < > > > | | | | | | | | | | | | > > > > > > > > | > > > | | | | | > > | > > | > > | > > | | | | > > > > | | > > > > > > > > > > > > > > > > > > > > > | > > > > > | < < | < < < < < < < < < < < > > > | > > | > | > | > > > > > | | | > > > > > | | < < < < < < < | | > > > > > > > > > > > > > | | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: DROP TABLE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>DROP TABLE</h2><p><b><a href="syntaxdiagrams.html#drop-table-stmt">drop-table-stmt:</a></b> <button id='x1049' onclick='hideorshow("x1049","x1050")'>hide</button></p> <blockquote id='x1050'> <img alt="syntax diagram drop-table-stmt" src="images/syntax/drop-table-stmt.gif" /> </blockquote> <p>The DROP TABLE statement removes a table added with the <a href="lang_createtable.html">CREATE TABLE</a> statement. The name specified is the table name. The dropped table is completely removed from the database schema and the disk file. The table can not be recovered. All indices and triggers associated with the table are also deleted.</p> <p>The optional IF EXISTS clause suppresses the error that would normally result if the table does not exist.</p> <p>If <a href="foreignkeys.html">foreign key constraints</a> are enabled, a DROP TABLE command performs an implicit <a href="lang_delete.html">DELETE FROM <tbl></a> command before removing the table from the database schema. Any triggers attached to the table are dropped from the database schema before the implicit DELETE FROM <tbl> is executed, so this cannot cause any triggers to fire. By contrast, an implicit DELETE FROM <tbl> does cause any configured <a href="foreignkeys.html#fk_actions">foreign key actions</a> to take place. If the implicit DELETE FROM <tbl> executed as part of a DROP TABLE command violates any immediate foreign key constraints, an error is returned and the table is not dropped. If the implicit DELETE FROM <tbl> causes any deferred foreign key constraints to be violated, and the violations still exist when the transaction is committed, an error is returned at the time of commit. |
Changes to Doc/Extra/Core/lang_droptrigger.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < < < < | < > | | | | | | | | | > > > > > > > > > > > > > | > > > | | | | | | | | | | | | | | | | | | | | | | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > > > > > > > | > > > | | | | | < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: DROP TRIGGER</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>DROP TRIGGER</h2><p><b><a href="syntaxdiagrams.html#drop-trigger-stmt">drop-trigger-stmt:</a></b> <button id='x1051' onclick='hideorshow("x1051","x1052")'>hide</button></p> <blockquote id='x1052'> <img alt="syntax diagram drop-trigger-stmt" src="images/syntax/drop-trigger-stmt.gif" /> </blockquote> <p>The DROP TRIGGER statement removes a trigger created by the <a href="lang_createtrigger.html">CREATE TRIGGER</a> statement. Once removed, the trigger definition is no longer present in the sqlite_master (or sqlite_temp_master) table and is not fired by any subsequent INSERT, UPDATE or DELETE statements. <p>Note that triggers are automatically dropped when the associated table is dropped. |
Changes to Doc/Extra/Core/lang_dropview.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < | > | | | | | | | | | | | | | > > > > > > > > > | > > > | | | | | > > | > > > > | | > | | < | > > > > | > | < | < > > > > | < < > > > > > > | < > > > > > > > > > | < > > > > > > | > > > > > > > > | > | > > > > > > > > | | | > > > | < < | < > > > | | | | < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: DROP VIEW</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>DROP VIEW</h2><p><b><a href="syntaxdiagrams.html#drop-view-stmt">drop-view-stmt:</a></b> <button id='x1053' onclick='hideorshow("x1053","x1054")'>hide</button></p> <blockquote id='x1054'> <img alt="syntax diagram drop-view-stmt" src="images/syntax/drop-view-stmt.gif" /> </blockquote> <p>The DROP VIEW statement removes a view created by the <a href="lang_createview.html">CREATE VIEW</a> statement. The view definition is removed from the database schema, but no actual data in the underlying base tables is modified. <p>The view to drop is identified by the view-name and optional database-name specified as part of the DROP VIEW statement. This reference is resolved using the standard procedure for <a href="lang_naming.html">object resolution</a>. <p> If the specified view cannot be found and the IF EXISTS clause is not present, it is an error. If the specified view cannot be found and an IF EXISTS clause is present in the DROP VIEW statement, then the statement is a no-op. |
Changes to Doc/Extra/Core/lang_explain.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | > > > | > | > > > > | > > > > > > > > > > > > > > > > > > | | | | < | > | < < < < < < | > | > > | > | > | > > > > | > | > > | > > > > > > > > > > > > > > > > > > | > | < < < < | > > > | < < | | > > > > | | | | > | > > > | | > > > | > | > > > > > | > > | | > > | > | | | < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: EXPLAIN</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>EXPLAIN</h2><p><b><a href="syntaxdiagrams.html#sql-stmt">sql-stmt:</a></b></p><blockquote> <img alt="syntax diagram sql-stmt" src="images/syntax/sql-stmt.gif"></img> </blockquote> <p>An SQL statement can be preceded by the keyword "EXPLAIN" or by the phrase "EXPLAIN QUERY PLAN". Either modification causes the SQL statement to behave as a query and to return information about how the SQL statement would have operated if the EXPLAIN keyword or phrase had been omitted.</p> <p>The output from EXPLAIN and EXPLAIN QUERY PLAN is intended for interactive analysis and troubleshooting only. The details of the output format are subject to change from one release of SQLite to the next. Applications should not use EXPLAIN or EXPLAIN QUERY PLAN since their exact behavior is variable and only partially documented.</p> <p>When the EXPLAIN keyword appears by itself it causes the statement to behave as a query that returns the sequence of <a href="opcode.html">virtual machine instructions</a> it would have used to execute the command had the EXPLAIN keyword not been present. When the EXPLAIN QUERY PLAN phrase appears, the statement returns high-level information regarding the query plan that would have been used. The EXPLAIN QUERY PLAN command is described in <a href="eqp.html">more detail here</a>. |
Changes to Doc/Extra/Core/lang_expr.html.
|
| | | | | < | | > > > > | | > | < > | | < < < | < < < | < | | < | < < > | | | | | < < < < < < < | | | > | < < < > | | | > > > > | < | < > > | < | > | < | | | | | | | | | | | | | | | | | | | | | | < < < | | | | | | | | | | | | | | | | | | | | | | | < < < < < < | | < > | | | | | | < < > > | | | | | | < < < < < < < < < < < | | < < | < < < > | > | | < > > | < > > | < | < < | | < < < < < < < > | | | | | | | < | < < < < > | < < > > > > | > > | | > | < | | < | > | | > | < | | | | | | | | < | > | > > | < < < | > | | | < | > | | | < | > | | > | < | > | | | | | | | < < < < < < < < | | | | | > > > > | | | | > > | > | | | | | | | | | | | | < < < < | < < < < < > | | | < < < | < | > > > > > > > > > | | | | < > | | | < < | < < < < < < < < < < < < < < | > | < | > | | | | | < | | | | | < | | | < | > > | < | | > | < | < | | | | | | | | | | | | | < < < < < < | < < < < < < > | > | | | | > > | > > | > > > | | < < | < < | | < | | < | | < | < < | > > > | < < | | < | | | > | < < < < | | | | < < < > > | > | | | | > > > > | | < < | | | | | < < | | | | > > | | | | > | < < < < < | | | < | < < > | < | | | | > | | < | | | | | | | | | | | | | | | | | < < < < | | | | | | | | | | < | < < < > | | > > | < | < < < < < < < < | | | | > | > | | < < | | | | | > | < | | < < | | < < > | < < > | > | | | | | > | < | | < < < < | > | | | < < < | < < < > | | | < < > > | | | | | | | | | | | | | | | | | | | | < < < < < < < < | | | | | | | | | | | | | | | | | | < < < < < | | | < | | | > > > > > > > > > > | | | | < < < | > | | < > | | | | < < < < < < < < < < < | | | | | | > | | | < > | | | < > | < | | > | | < | < < | | < | < > < | | < | < < < | < < | < < < < | < | < < | | | > > > > | | | > | > > > > > | | | | | | < | | > | | | | | | | | | | < < < | | < | < < | | | < | > | | | < | < < < < > | | > | > > > | | < | | < < < < | < | | | | > > > | > | > > > | | > | < < > | < < < | < | < < < | | | | < < < < | < < < < | < | < < > | < | > > > | < < | < < | > > | < > > > | > | < | | > > > > | > > > | | | | | | > | | > > > > | < | < < | | < < | | | | | | | < < < < < | | < < < < | | > > > > | | | | | | | | | | | | | | | | < < | < | > > | > | > > | | < < | < < < | | | | | | | | | < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: expression</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>expression</h2><p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x1055' onclick='hideorshow("x1055","x1056")'>hide</button></p> <blockquote id='x1056'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x1057' onclick='hideorshow("x1057","x1058")'>show</button></p> <blockquote id='x1058' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x1059' onclick='hideorshow("x1059","x1060")'>show</button></p> <blockquote id='x1060' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1061' onclick='hideorshow("x1061","x1062")'>show</button></p> <blockquote id='x1062' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1063' onclick='hideorshow("x1063","x1064")'>show</button></p> <blockquote id='x1064' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1065' onclick='hideorshow("x1065","x1066")'>show</button></p> <blockquote id='x1066' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1067' onclick='hideorshow("x1067","x1068")'>show</button></p> <blockquote id='x1068' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1069' onclick='hideorshow("x1069","x1070")'>show</button></p> <blockquote id='x1070' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1071' onclick='hideorshow("x1071","x1072")'>show</button></p> <blockquote id='x1072' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1073' onclick='hideorshow("x1073","x1074")'>show</button></p> <blockquote id='x1074' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1075' onclick='hideorshow("x1075","x1076")'>show</button></p> <blockquote id='x1076' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1077' onclick='hideorshow("x1077","x1078")'>show</button></p> <blockquote id='x1078' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1079' onclick='hideorshow("x1079","x1080")'>show</button></p> <blockquote id='x1080' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1081' onclick='hideorshow("x1081","x1082")'>show</button></p> <blockquote id='x1082' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p>This section is different from the others. Most other sections of this document talks about a particular SQL command. This section does not talk about a standalone command but about "expressions" which are subcomponents of most other commands.</p> <a name="binaryops"></a> <h3>Operators</h3> <p>SQLite understands the following binary operators, in order from highest to lowest precedence:</p> <blockquote><pre> <font color="#2c2cf0"><big>|| * / % + - << >> & | < <= > >= = == != <> </big>IS IS NOT IN LIKE GLOB MATCH REGEXP AND OR</font> </pre></blockquote> <p>Supported unary prefix operators are these:</p> <blockquote><pre> <font color="#2c2cf0"><big>- + ~ NOT</big></font> </pre></blockquote> <a name="collateop"></a> <p>The COLLATE operator is a unary postfix operator that assigns a <a href="datatype3.html#collation">collating sequence</a> to an expression. The COLLATE operator has a higher precedence (binds more tightly) than any binary operator and any unary prefix operator except "~". (COLLATE and "~" are associative so their binding order does not matter.) The collating sequence set by the COLLATE operator overrides the collating sequence determined by the COLLATE clause in a table <a href="lang_createtable.html#tablecoldef">column definition</a>. See the <a href="datatype3.html#collation">detailed discussion on collating sequences</a> in the <a href="datatype3.html">Datatype In SQLite3</a> document for additional information. </p> <p>The unary operator <font color="#2c2cf0"><big>+</big></font> is a no-op. It can be applied to strings, numbers, blobs or NULL and it always returns a result with the same value as the operand.</p> <p>Note that there are two variations of the equals and not equals operators. Equals can be either <font color="#2c2cf0"><big>=</big></font> or <font color="#2c2cf0"><big>==</big></font>. The non-equals operator can be either <font color="#2c2cf0"><big>!=</big></font> or <font color="#2c2cf0"><big><></big></font>. The <font color="#2c2cf0"><big>||</big></font> operator is "concatenate" - it joins together the two strings of its operands. The operator <font color="#2c2cf0"><big>%</big></font> outputs the value of its left operand modulo its right operand.</p> <p>The result of any binary operator is either a numeric value or NULL, except for the <font color="#2c2cf0"><big>||</big></font> concatenation operator which always evaluates to either NULL or a text value.</p><a name="isisnot"></a> <p>The <font color="#2c2cf0"><big>IS</big></font> and <font color="#2c2cf0"><big>IS NOT</big></font> operators work like <font color="#2c2cf0"><big>=</big></font> and <font color="#2c2cf0"><big>!=</big></font> except when one or both of the operands are NULL. In this case, if both operands are NULL, then the IS operator evaluates to 1 (true) and the IS NOT operator evaluates to 0 (false). If one operand is NULL and the other is not, then the IS operator evaluates to 0 (false) and the IS NOT operator is 1 (true). It is not possible for an IS or IS NOT expression to evaluate to NULL. Operators <font color="#2c2cf0"><big>IS</big></font> and <font color="#2c2cf0"><big>IS NOT</big></font> have the same precedence as <font color="#2c2cf0"><big>=</big></font>.<a name="litvalue"></a> <h3>Literal Values</h3> <p> A literal value is a constant of some kind. Literal values may be integers, floating point numbers, strings, BLOBs, or NULLs.</p> <p>The syntax for integer and floating point literals (collectively "numeric literals") is shown by the following diagram:</p> <p><b><a href="syntaxdiagrams.html#numeric-literal">numeric-literal:</a></b></p><blockquote> <img alt="syntax diagram numeric-literal" src="images/syntax/numeric-literal.gif"></img> </blockquote> <p> If a numeric literal has a decimal point or an exponentiation clause, then it is a floating point literal. Otherwise is it is an integer literal. The "E" character that begins the exponentiation clause of a floating point literal can be either upper or lower case. The "." character is always used as the decimal point even if the locale setting specifies "," for this role - the use of "," for the decimal point would result in syntactic ambiguity.</p> <p> A string constant is formed by enclosing the string in single quotes ('). A single quote within the string can be encoded by putting two single quotes in a row - as in Pascal. C-style escapes using the backslash character are not supported because they are not standard SQL. BLOB literals are string literals containing hexadecimal data and preceded by a single "x" or "X" character. For example:</p> <blockquote><pre> X'53514C697465' </pre></blockquote> <p> A literal value can also be the token "NULL". </p> <a name="varparam"></a> <h3>Parameters</h3> <p> A "variable" or "parameter" token specifies a placeholder in the expression for a value that is filled in at runtime using the <a href="c3ref/bind_blob.html">sqlite3_bind()</a> family of C/C++ interfaces. Parameters can take several forms: </p> <blockquote> <table> <tr> <td align="right" valign="top"><b>?</b><i>NNN</i></td><td width="20"></td> <td>A question mark followed by a number <i>NNN</i> holds a spot for the NNN-th parameter. NNN must be between 1 and <a href="limits.html#max_variable_number">SQLITE_MAX_VARIABLE_NUMBER</a>. </td> </tr> <tr> <td align="right" valign="top"><b>?</b></td><td width="20"></td> <td>A question mark that is not followed by a number creates a parameter with a number one greater than the largest parameter number already assigned. If this means the parameter number is greater than <a href="limits.html#max_variable_number">SQLITE_MAX_VARIABLE_NUMBER</a>, it is an error. </td> </tr> <tr> <td align="right" valign="top"><b>:</b><i>AAAA</i></td><td width="20"></td> <td>A colon followed by an identifier name holds a spot for a <a href="c3ref/bind_parameter_name.html">named parameter</a> with the name :AAAA. Named parameters are also numbered. The number assigned is one greater than the largest parameter number already assigned. If this means the parameter would be assigned a number greater than <a href="limits.html#max_variable_number">SQLITE_MAX_VARIABLE_NUMBER</a>, it is an error. To avoid confusion, it is best to avoid mixing named and numbered parameters.</td> </tr> <tr> <td align="right" valign="top"><b>@</b><i>AAAA</i></td><td width="20"></td> <td>An "at" sign works exactly like a colon, except that the name of the parameter created is @AAAA.</td> </tr> <tr> <td align="right" valign="top"><b>$</b><i>AAAA</i></td><td width="20"></td> <td>A dollar-sign followed by an identifier name also holds a spot for a named parameter with the name $AAAA. The identifier name in this case can include one or more occurrences of "::" and a suffix enclosed in "(...)" containing any text at all. This syntax is the form of a variable name in the <a href="http://www.tcl.tk/">Tcl programming language</a>. The presence of this syntax results from the fact that SQLite is really a <a href="tclsqlite.html">Tcl extension</a> that has escaped into the wild.</td> </tr> </table> </blockquote> <p>Parameters that are not assigned values using <a href="c3ref/bind_blob.html">sqlite3_bind()</a> are treated as NULL.</p> <p>The maximum parameter number is set at compile-time by the <a href="limits.html#max_variable_number">SQLITE_MAX_VARIABLE_NUMBER</a> macro. An individual <a href="c3ref/sqlite3.html">database connections</a> D can reduce its maximum parameter number below the compile-time maximum using the <a href="c3ref/limit.html">sqlite3_limit</a>(D, <a href="c3ref/c_limit_attached.html#sqlitelimitvariablenumber">SQLITE_LIMIT_VARIABLE_NUMBER</a>,...) interface. </p> <a name="like"></a> <h3>The LIKE and GLOB operators</h3> <p>The LIKE operator does a pattern matching comparison. The operand to the right of the LIKE operator contains the pattern and the left hand operand contains the string to match against the pattern. A percent symbol ("%") in the LIKE pattern matches any sequence of zero or more characters in the string. An underscore ("_") in the LIKE pattern matches any single character in the string. Any other character matches itself or its lower/upper case equivalent (i.e. case-insensitive matching). (A bug: SQLite only understands upper/lower case for ASCII characters by default. The LIKE operator is case sensitive by default for unicode characters that are beyond the ASCII range. For example, the expression <b>'a' LIKE 'A'</b> is TRUE but <b>'æ' LIKE 'Æ'</b> is FALSE.)<p> <p>If the optional ESCAPE clause is present, then the expression following the ESCAPE keyword must evaluate to a string consisting of a single character. This character may be used in the LIKE pattern to include literal percent or underscore characters. The escape character followed by a percent symbol (%), underscore (_), or a second instance of the escape character itself matches a literal percent symbol, underscore, or a single escape character, respectively. <p>The infix LIKE operator is implemented by calling the application-defined SQL functions <a href="lang_corefunc.html#like">like(<i>Y</i>,<i>X</i>)</a> or <a href="lang_corefunc.html#like">like(<i>Y</i>,<i>X</i>,<i>Z</i>)</a></a>.</p> <p>The LIKE operator can be made case sensitive using the <a href="pragma.html#pragma_case_sensitive_like">case_sensitive_like pragma</a>.</p> <a name="glob"></a> <p>The GLOB operator is similar to LIKE but uses the Unix file globbing syntax for its wildcards. Also, GLOB is case sensitive, unlike LIKE. Both GLOB and LIKE may be preceded by the NOT keyword to invert the sense of the test. The infix GLOB operator is implemented by calling the function <a href="lang_corefunc.html#glob">glob(<i>Y</i>,<i>X</i>)</a> and can be modified by overriding that function.</p> <a name="regexp"></a> <p>The REGEXP operator is a special syntax for the regexp() user function. No regexp() user function is defined by default and so use of the REGEXP operator will normally result in an error message. If an <a href="c3ref/create_function.html">application-defined SQL function</a> named "regexp" is added at run-time, then the "<i>X</i> REGEXP <i>Y</i>" operator will be implemented as a call to "regexp(<i>Y</i>,<i>X</i>)".</p> <a name="match"></a> <p>The MATCH operator is a special syntax for the match() application-defined function. The default match() function implementation raises an exception and is not really useful for anything. But extensions can override the match() function with more helpful logic.</p> <a name="between"></a> <h3>The BETWEEN operator</h3> <p>The BETWEEN operator is logically equivalent to a pair of comparisons. "<i>x</i> <b>BETWEEN</b> <i>y</i> <b>AND</b> <i>z</i>" is equivalent to "<i>x</i><b>>=</b><i>y</i> <b>AND</b> <i>x</i><b><=</b><i>z</i>" except that with BETWEEN, the <i>x</i> expression is only evaluated once. The precedence of the BETWEEN operator is the same as the precedence as operators <b>==</b> and <b>!=</b> and <b>LIKE</b> and groups left to right. <a name="case"></a> <h3>The CASE expression</h3> <p>A CASE expression serves a role similar to IF-THEN-ELSE in other programming languages. <p>The optional expression that occurs in between the CASE keyword and the first WHEN keyword is called the "base" expression. There are two basic forms of the CASE expression: those with a base expression and those without. <p>In a CASE without a base expression, each WHEN expression is evaluated and the result treated as a boolean, starting with the leftmost and continuing to the right. The result of the CASE expression is the evaluation of the THEN expression that corresponds to the first WHEN expression that evaluates to true. Or, if none of the WHEN expressions evaluate to true, the result of evaluating the ELSE expression, if any. If there is no ELSE expression and none of the WHEN expressions are true, then the overall result is NULL. <p>A NULL result is considered untrue when evaluating WHEN terms. <p>In a CASE with a base expression, the base expression is evaluated just once and the result is compared against the evaluation of each WHEN expression from left to right. The result of the CASE expression is the evaluation of the THEN expression that corresponds to the first WHEN expression for which the comparison is true. Or, if none of the WHEN expressions evaluate to a value equal to the base expression, the result of evaluating the ELSE expression, if any. If there is no ELSE expression and none of the WHEN expressions produce a result equal to the base expression, the overall result is NULL. <p>When comparing a base expression against a WHEN expression, the same collating sequence, affinity, and NULL-handling rules apply as if the base expression and WHEN expression are respectively the left- and right-hand operands of an <big><b>=</b></big> operator.</p> If the base expression is NULL then the result of the CASE is always the result of evaluating the ELSE expression if it exists, or NULL if it does not. <p>Both forms of the CASE expression use lazy, or short-circuit, evaluation. <p>The only difference between the following two CASE expressions is that the <i>x</i> expression is evaluated exactly once in the first example but might be evaluated multiple times in the second: <ul><pre> <li>CASE x WHEN w1 THEN r1 WHEN w2 THEN r2 ELSE r3 END <li>CASE WHEN x=w1 THEN r1 WHEN x=w2 THEN r2 ELSE r3 END </pre></ul> <a name="in_op"></a> <h3>The IN and NOT IN operators</h3> <p>The IN and NOT IN operators take a single scalar operand on the left and a vector operand on the right formed by an explicit list of zero or more scalars or by a single subquery. When the right operand of an IN or NOT IN operator is a subquery, the subquery must have a single result column. When the right operand is an empty set, the result of IN is false and the result of NOT IN is true, regardless of the left operand and even if the left operand is NULL. The result of an IN or NOT IN operator is determined by the following matrix: <center> <table border=1> <tr> <th>Left operand <br>is NULL <th>Right operand <br>contains NULL <th>Right operand <br>is an empty set <th>Left operand found <br>within right operand <th>Result of <br>IN operator <th>Result of <br>NOT IN operator <tr> <td align="center">no <td align="center">no <td align="center">no <td align="center">no <td align="center">false <td align="center">true <tr> <td align="center">does not matter <td align="center">no <td align="center">yes <td align="center">no <td align="center">false <td align="center">true <tr> <td align="center">no <td align="center">does not matter <td align="center">no <td align="center">yes <td align="center">true <td align="center">false <tr> <td align="center">no <td align="center">yes <td align="center">no <td align="center">no <td align="center">NULL <td align="center">NULL <tr> <td align="center">yes <td align="center">does not matter <td align="center">no <td align="center">does not matter <td align="center">NULL <td align="center">NULL </table> </center> <p>Note that SQLite allows the parenthesized list of scalar values on the right-hand side of an IN or NOT IN operator to be an empty list but most other SQL database database engines and the SQL92 standard require the list to contain at least one element.</p> <a name="in_op"></a> <h3>The EXISTS operator</h3> <p>The EXISTS operator always evaluates to one of the integer values 0 and 1. If executing the SELECT statement specified as the right-hand operand of the EXISTS operator would return one or more rows, then the EXISTS operator evaluates to 1. If executing the SELECT would return no rows at all, then the EXISTS operator evaluates to 0. <p>The number of columns in each row returned by the SELECT statement (if any) and the specific values returned have no effect on the results of the EXISTS operator. In particular, rows containing NULL values are not handled any differently from rows without NULL values. <h3>Scalar Subqueries</h3> <p>A <a href="lang_select.html">SELECT</a> statement enclosed in parentheses may appear as a scalar quantity. A <a href="lang_select.html">SELECT</a> used as a scalar quantity must return a result set with a single column. The result of the expression is the value of the only column in the first row returned by the SELECT statement. If the SELECT yields more than one result row, all rows after the first are ignored. If the SELECT yields no rows, then the value of the expression is NULL. The LIMIT of a scalar subquery is always 1. Any other LIMIT value given in the SQL text is ignored. <p>All types of <a href="lang_select.html">SELECT</a> statement, including aggregate and <a href="lang_select.html#compound">compound SELECT</a> queries (queries with keywords like UNION or EXCEPT) are allowed as scalar subqueries. <h3>Table Column Names</h3> <p>A column name can be any of the names defined in the <a href="lang_createtable.html">CREATE TABLE</a> statement or one of the following special identifiers: "<b>ROWID</b>", "<b>OID</b>", or "<b>_ROWID_</b>". These special identifiers all describe the unique integer key (the <a href="lang_createtable.html#rowid">rowid</a>) associated with every row of every table. The special identifiers only refer to the row key if the <a href="lang_createtable.html">CREATE TABLE</a> statement does not define a real column with the same name. The rowid can be used anywhere a regular column can be used.</p> <p>A <a href="lang_select.html">SELECT</a> statement used as either a scalar subquery or as the right-hand operand of an IN, NOT IN or EXISTS expression may contain references to columns in the outer query. Such a subquery is known as a correlated subquery. A correlated subquery is reevaluated each time its result is required. An uncorrelated subquery is evaluated only once and the result reused as necessary. <a name="castexpr"></a> <h3>CAST expressions</h3> <p>A CAST expression of the form "CAST(<expr> AS <type-name>)" is used to convert the value of <expr> to a different <a href="datatype3.html#storageclasses">storage class</a> specified by <type-name>. A CAST conversion is similar to the conversion that takes place when a <a href="datatype3.html#affinity">column affinity</a> is applied to a value except that with the CAST operator the conversion always takes place even if the conversion lossy and irreversible, whereas column affinity only changes the data type of a value if the change is lossless and reversible. <p>If the value of <expr> is NULL, then the result of the CAST expression is also NULL. Otherwise, the storage class of the result is determined by applying the <a href="datatype3.html#affname">rules for determining column affinity</a> to the <type-name>. <table border=1> <tr> <th> Affinity of <type-name> <th> Conversion Processing <tr> <td> NONE <td> Casting a value to a <type-name> with no affinity causes the value to be converted into a BLOB. Casting to a BLOB consists of first casting the value to TEXT in the <a href="pragma.html#pragma_encoding">encoding</a> of the database connection, then interpreting the resulting byte sequence as a BLOB instead of as TEXT. <tr> <td> TEXT <td> To cast a BLOB value to TEXT, the sequence of bytes that make up the BLOB is interpreted as text encoded using the database encoding. <p> Casting an INTEGER or REAL value into TEXT renders the value as if via <a href="c3ref/mprintf.html">sqlite3_snprintf()</a> except that the resulting TEXT uses the <a href="pragma.html#pragma_encoding">encoding</a> of the database connection. <tr> <td> REAL <td> When casting a BLOB value to a REAL, the value is first converted to TEXT. <p>When casting a TEXT value to REAL, the longest possible prefix of the value that can be interpreted as a real number is extracted from the TEXT value and the remainder ignored. Any leading spaces in the TEXT value are ignored when converging from TEXT to REAL. If there is no prefix that can be interpreted as a real number, the result of the conversion is 0.0. <tr> <td> INTEGER <td> When casting a BLOB value to INTEGER, the value is first converted to TEXT. <p>When casting a TEXT value to INTEGER, the longest possible prefix of the value that can be interpreted as an integer number is extracted from the TEXT value and the remainder ignored. Any leading spaces in the TEXT value when converting from TEXT to INTEGER are ignored. If there is no prefix that can be interpreted as an integer number, the result of the conversion is 0. <p>A cast of a REAL value into an INTEGER results in the integer between the REAL value and zero that is closest to the REAL value. If a REAL is greater than the greatest possible signed integer (+9223372036854775807) then the result is the greatest possible signed integer and if the REAL is less than the least possible signed integer (-9223372036854775808) then the result is the least possible signed integer. <p>Prior to SQLite version 3.8.2, casting a REAL value greater than +9223372036854775807.0 into an integer resulted in the most negative integer, -9223372036854775808. This behavior was meant to emulate the behavior of x86/x64 hardware when doing the equivalent cast. <tr> <td> NUMERIC <td> Casting a TEXT or BLOB value into NUMERIC first does a forced conversion into REAL but then further converts the result into INTEGER if and only if the conversion from REAL to INTEGER is lossless and reversible. This is the only context in SQLite where the NUMERIC and INTEGER <a href="datatype3.html#affinity">affinities</a> behave differently. <p> Casting a REAL or INTEGER value to NUMERIC is a no-op, even if a real value could be losslessly converted to an integer. </tr> </table> <p>Note that the result from casting any non-BLOB value into a BLOB and the result from casting any BLOB value into a non-BLOB value may be different depending on whether the database <a href="pragma.html#pragma_encoding">encoding</a> is UTF-8, UTF-16be, or UTF-16le. <a name="booleanexpr"></a> <h3>Boolean Expressions</h3> <p>The SQL language features several contexts where an expression is evaluated and the result converted to a boolean (true or false) value. These contexts are: <ul> <li> the WHERE clause of a SELECT, UPDATE or DELETE statement, <li> the ON or USING clause of a join in a SELECT statement, <li> the HAVING clause of a SELECT statement, <li> the WHEN clause of an SQL trigger, and <li> the WHEN clause or clauses of some CASE expressions. </ul> <p>To convert the results of an SQL expression to a boolean value, SQLite first casts the result to a NUMERIC value in the same way as a <a href="lang_expr.html#castexpr">CAST expression</a>. A NULL or zero value (integer value 0 or real value 0.0) is considered to be false. All other values are considered true. <p>For example, the values NULL, 0.0, 0, 'english' and '0' are all considered to be false. Values 1, 1.0, 0.1, -0.1 and '1english' are considered to be true. <h3>Functions</h3> <p>Both <a href="lang_corefunc.html">simple</a> and <a href="lang_aggfunc.html">aggregate</a> functions are supported. (For presentation purposes, simple functions are further subdivided into <a href="lang_corefunc.html">core functions</a> and <a href="lang_datefunc.html">date-time functions</a>.) A simple function can be used in any expression. Simple functions return a result immediately based on their inputs. Aggregate functions may only be used in a SELECT statement. Aggregate functions compute their result across all rows of the result set.</p> |
Added Doc/Extra/Core/lang_indexedby.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: INDEXED BY</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>INDEXED BY</h2> <p>The INDEXED BY phrase forces the <a href="optoverview.html">SQLite query planner</a> to use a particular named index on a <a href="lang_delete.html">DELETE</a>, <a href="lang_select.html">SELECT</a>, or <a href="lang_update.html">UPDATE</a> statement. The INDEXED BY phrase is an extension that is particular to SQLite and is not portable to other SQL database engines. The INDEXED BY phrase can be seen in the following syntax diagrams:</p> <p><b><a href="syntaxdiagrams.html#qualified-table-name">qualified-table-name:</a></b> <button id='x1417' onclick='hideorshow("x1417","x1418")'>hide</button></p> <blockquote id='x1418'> <img alt="syntax diagram qualified-table-name" src="images/syntax/qualified-table-name.gif" /> </blockquote> <p>The "INDEXED BY index-name" phrase specifies that the named index must be used in order to look up values on the preceding table. If index-name does not exist or cannot be used for the query, then the preparation of the SQL statement fails. The "NOT INDEXED" clause specifies that no index shall be used when accessing the preceding table, including implied indices create by UNIQUE and PRIMARY KEY constraints. However, the INTEGER PRIMARY KEY can still be used to look up entries even when "NOT INDEXED" is specified.</p> <p>Some SQL database engines provide non-standard "hint" mechanisms which can be used to give the query optimizer clues about what indices it should use for a particular statement. The INDEX BY clause of SQLite is <em>not</em> a hinting mechanism and it should not be used as such. The INDEXED BY clause does not give the optimizer hints about which index to use; it gives the optimizer a requirement of which index to use. If the query optimizer is unable to use the index specified by the INDEX BY clause, then the query will fail with an error.</p> <p>The INDEXED BY clause is <em>not</em> intended for use in tuning the performance of a query. The intent of the INDEXED BY clause is to raise a run-time error if a schema change, such as dropping or creating an index, causes the query plan for a time-sensitive query to change. The INDEXED BY clause is designed to help detect undesirable query plan changes during regression testing. Developers are admonished to omit all use of INDEXED BY during application design, implementation, testing, and tuning. If INDEXED BY is to be used at all, it should be inserted at the very end of the development process when "locking down" a design.</p> <h3>See Also:</h3> <ol> <li><p>The <a href="queryplanner-ng.html#howtofix">query planner checklist</a> describes steps that application developers should following to help resolve query planner problems. Notice the that the use of INDEXED BY is a last resort, to be used only when all other measures fail.</p> <li><p><a href="optoverview.html#uplus">The unary "+" operator</a> can be used to disqualify terms in the WHERE clause from use by indices. Careful use of unary + can sometimes help prevent the query planner from choosing a poor index without restricting it to using one specific index. Careful placement of unary + operators is a better method for controlling which indices are used by a query.</p> <li><p>The <a href="c3ref/stmt_status.html">sqlite3_stmt_status()</a> C/C++ interface together with the <a href="c3ref/c_stmtstatus_counter.html#sqlitestmtstatusfullscanstep">SQLITE_STMTSTATUS_FULLSCAN_STEP</a> and <a href="c3ref/c_stmtstatus_counter.html#sqlitestmtstatussort">SQLITE_STMTSTATUS_SORT</a> verbs can be used to detect at run-time when an SQL statement is not making effective use of indices. Many applications may prefer to use the <a href="c3ref/stmt_status.html">sqlite3_stmt_status()</a> interface to detect index misuse rather than the INDEXED BY phrase described here.</p> </ol> <DIV class="pdf_section"> |
Changes to Doc/Extra/Core/lang_insert.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | | < | < | > > > > | > > > > | > > > > > > > > > > > > > > > > > > | | < < < | > > > | > | < < | > > | > | | > > > > > | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | < < > > > | < < < < < < | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > | | | > | > > > > > > > > | > > > > | | < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > | > > | > > > > | > > > > > > > | > > > > > > > | > > > > > | > | | > > | | > | | < > > > > > | < < | | | < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: INSERT</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>INSERT</h2><p><b><a href="syntaxdiagrams.html#insert-stmt">insert-stmt:</a></b> <button id='x1083' onclick='hideorshow("x1083","x1084")'>hide</button></p> <blockquote id='x1084'> <img alt="syntax diagram insert-stmt" src="images/syntax/insert-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x1085' onclick='hideorshow("x1085","x1086")'>show</button></p> <blockquote id='x1086' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x1087' onclick='hideorshow("x1087","x1088")'>show</button></p> <blockquote id='x1088' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x1089' onclick='hideorshow("x1089","x1090")'>show</button></p> <blockquote id='x1090' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1091' onclick='hideorshow("x1091","x1092")'>show</button></p> <blockquote id='x1092' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1093' onclick='hideorshow("x1093","x1094")'>show</button></p> <blockquote id='x1094' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1095' onclick='hideorshow("x1095","x1096")'>show</button></p> <blockquote id='x1096' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1097' onclick='hideorshow("x1097","x1098")'>show</button></p> <blockquote id='x1098' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1099' onclick='hideorshow("x1099","x1100")'>show</button></p> <blockquote id='x1100' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1101' onclick='hideorshow("x1101","x1102")'>show</button></p> <blockquote id='x1102' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1103' onclick='hideorshow("x1103","x1104")'>show</button></p> <blockquote id='x1104' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1105' onclick='hideorshow("x1105","x1106")'>show</button></p> <blockquote id='x1106' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1107' onclick='hideorshow("x1107","x1108")'>show</button></p> <blockquote id='x1108' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1109' onclick='hideorshow("x1109","x1110")'>show</button></p> <blockquote id='x1110' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1111' onclick='hideorshow("x1111","x1112")'>show</button></p> <blockquote id='x1112' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#with-clause">with-clause:</a></b> <button id='x1113' onclick='hideorshow("x1113","x1114")'>show</button></p> <blockquote id='x1114' style='display:none;'> <img alt="syntax diagram with-clause" src="images/syntax/with-clause.gif" /> <p><b><a href="syntaxdiagrams.html#cte-table-name">cte-table-name:</a></b> <button id='x1115' onclick='hideorshow("x1115","x1116")'>show</button></p> <blockquote id='x1116' style='display:none;'> <img alt="syntax diagram cte-table-name" src="images/syntax/cte-table-name.gif" /> </blockquote> </blockquote> </blockquote> <p>The INSERT statement comes in three basic forms. <ul> <li><p>The first form (with the "VALUES" keyword) creates one or more new rows in an existing table. If no column-list is specified then the number of values inserted into each row must be the same as the number of columns in the table. In this case the result of evaluating the left-most expression in each term of the VALUES list is inserted into the left-most column of the each new row, and forth for each subsequent expression. If a column-list is specified, then the number of values in each term of the VALUE list must match the number of specified columns. Each of the named columns of the new row is populated with the results of evaluating the corresponding VALUES expression. Table columns that do not appear in the column list are populated with the default column value (specified as part of the CREATE TABLE statement), or with NULL if no default value is specified. <li><p>The second form of the INSERT statement contains a SELECT statement instead of a VALUES clause. A new entry is inserted into the table for each row of data returned by executing the SELECT statement. If a column-list is specified, the number of columns in the result of the SELECT must be the same as the number of items in the column-list. Otherwise, if no column-list is specified, the number of columns in the result of the SELECT must be the same as the number of columns in the table. Any SELECT statement, including <a href="lang_select.html#compound">compound SELECTs</a> and SELECT statements with <a href="lang_select.html#orderby">ORDER BY</a> and/or <a href="lang_select.html#limitoffset">LIMIT</a> clauses, may be used in an INSERT statement of this form. <li><p>The third form of an INSERT statement is with DEFAULT VALUES. The INSERT ... DEFAULT VALUES statement inserts a single new row into the named table. Each column of the new row is populated with its default value, or with a NULL if no default value is specified as part of the column definition in the CREATE TABLE statement. </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 <a href="lang_conflict.html">ON CONFLICT</a> 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 <a href="lang_createtrigger.html">CREATE TRIGGER</a> statements. Similarly, the "DEFAULT VALUES" form of the INSERT statement is supported for top-level INSERT statements only and not for INSERT statements within triggers. <p> |
Added Doc/Extra/Core/lang_keywords.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: SQLite Keywords</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>SQLite Keywords</h2></DIV> <p>The SQL standard specifies a huge number of keywords which may not be used as the names of tables, indices, columns, databases, user-defined functions, collations, virtual table modules, or any other named object. The list of keywords is so long that few people can remember them all. For most SQL code, your safest bet is to never use any English language word as the name of a user-defined object.</p> <p>If you want to use a keyword as a name, you need to quote it. There are four ways of quoting keywords in SQLite:</p> <p> <blockquote> <table> <tr> <td valign="top"><b>'keyword'</b></td><td width="20"></td> <td>A keyword in single quotes is a string literal.</td></tr> <tr> <td valign="top"><b>"keyword"</b></td><td></td> <td>A keyword in double-quotes is an identifier.</td></tr> <tr> <td valign="top"><b>[keyword]</b></td><td></td> <td>A keyword enclosed in square brackets is an identifier. This is not standard SQL. This quoting mechanism is used by MS Access and SQL Server and is included in SQLite for compatibility.</td></tr> <tr> <td valign="top"><b>`keyword`</b></td><td></td> <td>A keyword enclosed in grave accents (ASCII code 96) is an identifier. This is not standard SQL. This quoting mechanism is used by MySQL and is included in SQLite for compatibility.</td></tr> </table> </blockquote> </p> <p>For resilience when confronted with historical SQL statements, SQLite will sometimes bend the quoting rules above:</p> <ul> <li><p>If a keyword in single quotes (ex: <b>'key'</b> or <b>'glob'</b>) is used in a context where an identifier is allowed but where a string literal is not allowed, then the token is understood to be an identifier instead of a string literal. </p></li> <li><p>If a keyword in double quotes (ex: <b>"key"</b> or <b>"glob"</b>) is used in a context where it cannot be resolved to an identifier but where a string literal is allowed, then the token is understood to be a string literal instead of an identifier.</p></li> </ul> <p>Programmers are cautioned not to use the two exceptions described in the previous bullets. We emphasize that they exist only so that old and ill-formed SQL statements will run correctly. Future versions of SQLite might raise errors instead of accepting the malformed statements covered by the exceptions above.</p> <p> SQLite adds new keywords from time to time when it takes on new features. So to prevent your code from being broken by future enhancements, you should normally quote any identifier that is an English language word, even if you do not have to. </p> <p> The list below shows all possible keywords used by any build of SQLite regardless of <a href="compile.html">compile-time options</a>. Most reasonable configurations use most or all of these keywords, but some keywords may be omitted when SQL language features are disabled. Regardless of the compile-time configuration, any identifier that is not on the following 124 element list is not a keyword to the SQL parser in SQLite: </p> <blockquote> <table width="100%"><tr> <td align="left" valign="top" width="20%"> ABORT<br> ACTION<br> ADD<br> AFTER<br> ALL<br> ALTER<br> ANALYZE<br> AND<br> AS<br> ASC<br> ATTACH<br> AUTOINCREMENT<br> BEFORE<br> BEGIN<br> BETWEEN<br> BY<br> CASCADE<br> CASE<br> CAST<br> CHECK<br> COLLATE<br> COLUMN<br> COMMIT<br> CONFLICT<br> CONSTRAINT<br> </td><td valign="top" align="left" width="20%">CREATE<br> CROSS<br> CURRENT_DATE<br> CURRENT_TIME<br> CURRENT_TIMESTAMP<br> DATABASE<br> DEFAULT<br> DEFERRABLE<br> DEFERRED<br> DELETE<br> DESC<br> DETACH<br> DISTINCT<br> DROP<br> EACH<br> ELSE<br> END<br> ESCAPE<br> EXCEPT<br> EXCLUSIVE<br> EXISTS<br> EXPLAIN<br> FAIL<br> FOR<br> FOREIGN<br> </td><td valign="top" align="left" width="20%">FROM<br> FULL<br> GLOB<br> GROUP<br> HAVING<br> IF<br> IGNORE<br> IMMEDIATE<br> IN<br> INDEX<br> INDEXED<br> INITIALLY<br> INNER<br> INSERT<br> INSTEAD<br> INTERSECT<br> INTO<br> IS<br> ISNULL<br> JOIN<br> KEY<br> LEFT<br> LIKE<br> LIMIT<br> MATCH<br> </td><td valign="top" align="left" width="20%">NATURAL<br> NO<br> NOT<br> NOTNULL<br> NULL<br> OF<br> OFFSET<br> ON<br> OR<br> ORDER<br> OUTER<br> PLAN<br> PRAGMA<br> PRIMARY<br> QUERY<br> RAISE<br> RECURSIVE<br> REFERENCES<br> REGEXP<br> REINDEX<br> RELEASE<br> RENAME<br> REPLACE<br> RESTRICT<br> RIGHT<br> </td><td valign="top" align="left" width="20%">ROLLBACK<br> ROW<br> SAVEPOINT<br> SELECT<br> SET<br> TABLE<br> TEMP<br> TEMPORARY<br> THEN<br> TO<br> TRANSACTION<br> TRIGGER<br> UNION<br> UNIQUE<br> UPDATE<br> USING<br> VACUUM<br> VALUES<br> VIEW<br> VIRTUAL<br> WHEN<br> WHERE<br> WITH<br> WITHOUT<br> </td></tr></table></blockquote> |
Added Doc/Extra/Core/lang_naming.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: Database Object Name Resolution</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>Database Object Name Resolution</h2> <p> In SQLite, a database object (a table, index, trigger or view) is identified by the name of the object and the name of the database that it resides in. Database objects may reside in the main database, the temp database, or in an <a href="lang_attach.html">attached database</a>. <p> The syntax of the <a href="lang_droptable.html">DROP TABLE</a>, <a href="lang_dropindex.html">DROP INDEX</a>, <a href="lang_dropview.html">DROP VIEW</a>, <a href="lang_droptrigger.html">DROP TRIGGER</a>, <a href="lang_reindex.html">REINDEX</a>, <a href="lang_altertable.html">ALTER TABLE</a> and many other commands all permit the user to specify a database object either by its name alone, or by a combination of its name and the name of its database. If no database is specified as part of the object reference, then SQLite searches the main, temp and all attached databases for an object with a matching name. The temp database is searched first, followed by the main database, followed all attached databases in the order that they were attached. The reference resolves to the first match found. For example: <pre> /* Add a table named 't1' to the temp, main and an attached database */ ATTACH 'file.db' AS aux; CREATE TABLE t1(x, y); CREATE TEMP TABLE t1(x, y); CREATE TABLE aux.t1(x, y); DROP TABLE t1; /* Drop table in temp database */ DROP TABLE t1; /* Drop table in main database */ DROP TABLE t1; /* Drop table in aux database */ </pre> <p> If a database name is specified as part of an object reference, it must be either "main", or "temp" or the name of an attached database. Like other SQL identifiers, database names are case-insensitive. If a database name is specified, then only the named database is searched for the named object. <p> Most object references may only resolve to a specific type of object (for example a reference that is part of a DROP TABLE statement may only resolve to a table object, not an index, trigger or view). However in some contexts (e.g. <a href="lang_reindex.html">REINDEX</a>) an object reference may be resolve to more than one type of object. When searching database schemas for a named object, objects of types that cannot be used in the context of the reference are always ignored. |
Changes to Doc/Extra/Core/lang_reindex.html.
|
| | | | | | < | > > | > | > > | > | < | < | < > | | > > | > | < < > > | > > > | > > | | > > | | | | | | > | > > > > > > > > > > > > > | > > > | | | | | | | | | | < < | > > | | < < < | | | | | | < < | < < < < < < | | | | > > > > > > > > | > > > > > > | > > > > > > > > > > > | | > > > > > > > > | > | > > > > > | | > > | | > > > > > > > > > > > | | > | | | | < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: REINDEX</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>REINDEX</h2><p><b><a href="syntaxdiagrams.html#reindex-stmt">reindex-stmt:</a></b> <button id='x1119' onclick='hideorshow("x1119","x1120")'>hide</button></p> <blockquote id='x1120'> <img alt="syntax diagram reindex-stmt" src="images/syntax/reindex-stmt.gif" /> </blockquote> <p>The REINDEX command is used to delete and recreate indices from scratch. This is useful when the definition of a collation sequence has changed. </p> <p>If the REINDEX keyword is not followed by a collation-sequence or database object identifier, then all indices in all attached databases are rebuilt. <p>If the REINDEX keyword is followed by a collation-sequence name, then all indices in all attached databases that use the named collation sequences are recreated. <p>Or, if the argument attached to the REINDEX identifies a specific database table, then all indices attached to the database table are rebuilt. If it identifies a specific database index, then just that index is recreated. <p>If no <i>database-name</i> is specified and there exists both a table or index and a collation sequence of the specified name, SQLite interprets this as a request to rebuild the indices that use the named collation sequence. This ambiguity in the syntax may be avoided by always specifying a <i>database-name</i> when reindexing a specific table or index. |
Changes to Doc/Extra/Core/lang_replace.html.
|
| | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | < | > | < < < < < < < < < < < < | > | < | | | | < < < | | | | | > > | > | | | < > > > > > | < > > > > > > > > > | > > > > > | < < | < < < > > > > > | < < < < < < < < < > < | | > | > > > | | | | | < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: REPLACE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>REPLACE</h2> <p>The REPLACE command is an alias for the "<a href="lang_conflict.html">INSERT OR REPLACE</a>" variant of the <a href="lang_insert.html">INSERT</a> command. This alias is provided for compatibility other SQL database engines. See the <a href="lang_insert.html">INSERT</a> command documentation for additional information.</p> |
Added Doc/Extra/Core/lang_savepoint.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: SAVEPOINT</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>SAVEPOINT</h2><p><b><a href="syntaxdiagrams.html#savepoint-stmt">savepoint-stmt:</a></b> <button id='x803' onclick='hideorshow("x803","x804")'>hide</button></p> <blockquote id='x804'> <img alt="syntax diagram savepoint-stmt" src="images/syntax/savepoint-stmt.gif" /> </blockquote> <p> SAVEPOINTs are a method of creating transactions, similar to <a href="lang_transaction.html">BEGIN</a> and <a href="lang_transaction.html">COMMIT</a>, except that the SAVEPOINT and RELEASE commands are named and may be nested.</p> <p> The SAVEPOINT command starts a new transaction with a name. The transaction names need not be unique. A SAVEPOINT can be started either within or outside of a <a href="lang_transaction.html">BEGIN</a>...<a href="lang_transaction.html">COMMIT</a>. When a SAVEPOINT is the outer-most savepoint and it is not within a <a href="lang_transaction.html">BEGIN</a>...<a href="lang_transaction.html">COMMIT</a> then the behavior is the same as BEGIN DEFERRED TRANSACTION.</p> <p>The ROLLBACK TO command reverts the state of the database back to what it was just after the corresponding SAVEPOINT. Note that unlike that plain <a href="lang_transaction.html">ROLLBACK</a> command (without the TO keyword) the ROLLBACK TO command does not cancel the transaction. Instead of cancelling the transaction, the ROLLBACK TO command restarts the transaction again at the beginning. All intervening SAVEPOINTs are canceled, however.</p> <p>The RELEASE command is like a <a href="lang_transaction.html">COMMIT</a> for a SAVEPOINT. The RELEASE command causes all savepoints back to and including the most recent savepoint with a matching name to be removed from the transaction stack. The RELEASE of an inner transaction does not cause any changes to be written to the database file; it merely removes savepoints from the transaction stack such that it is no longer possible to ROLLBACK TO those savepoints. If a RELEASE command releases the outermost savepoint, so that the transaction stack becomes empty, then RELEASE is the same as <a href="lang_transaction.html">COMMIT</a>. The <a href="lang_transaction.html">COMMIT</a> command may be used to release all savepoints and commit the transaction even if the transaction was originally started by a SAVEPOINT command instead of a <a href="lang_transaction.html">BEGIN</a> command.</p> <p>If the savepoint-name in a RELEASE command does not match any savepoint currently in the transaction stack, then no savepoints are released, the database is unchanged, and the RELEASE command returns an error.</p> <p>Note that an inner transaction might commit (using the RELEASE command) but then later have its work undone by a ROLLBACK in an outer transaction. A power failure or program crash or OS crash will cause the outer-most transaction to rollback, undoing all changes that have occurred within that outer transaction, even changes that have supposedly been "committed" by the RELEASE command. Content is not actually committed on the disk until the outermost transaction commits.</p> <p>There are several ways of thinking about the RELEASE command:</p> <ul> <li><p> Some people view RELEASE as the equivalent of COMMIT for a SAVEPOINT. This is an acceptable point of view as long as one remembers that the changes committed by an inner transaction might later be undone by a rollback in an outer transaction.</p></li> <li><p> Another view of RELEASE is that it merges a named transaction into its parent transaction, so that the named transaction and its parent become the same transaction. After RELEASE, the named transaction and its parent will commit or rollback together, whatever their fate may be. </p></li> <li><p> One can also think of savepoints as "marks" in the transaction timeline. In this view, the SAVEPOINT command creates a new mark, the ROLLBACK TO command rewinds the timeline back to a point just after the named mark, and the RELEASE command erases marks from the timeline without actually making any changes to the database. </p></li> </ul> <h3>Transaction Nesting Rules</h3> <p>The last transaction started will be the first transaction committed or rolled back.</p> <p>The <a href="lang_transaction.html">BEGIN</a> command only works if the transaction stack is empty, or in other words if there are no pending transactions. If the transaction stack is not empty when the <a href="lang_transaction.html">BEGIN</a> command is invoked, then the command fails with an error.</p> <p>The <a href="lang_transaction.html">COMMIT</a> command commits all outstanding transactions and leaves the transaction stack empty.</p> <p>The RELEASE command starts with the most recent addition to the transaction stack and releases savepoints backwards in time until it releases a savepoint with a matching savepoint-name. Prior savepoints, even savepoints with matching savepoint-names, are unchanged. If the RELEASE command causes the transaction stack to become empty (if the RELEASE command releases the outermost transaction from the stack) then the transaction commits.</p> <p>The <a href="lang_transaction.html">ROLLBACK</a> command without a TO clause rolls backs all transactions and leaves the transaction stack empty.</p> <p>The ROLLBACK command with a TO clause rolls back transactions going backwards in time back to the most recent SAVEPOINT with a matching name. The SAVEPOINT with the matching name remains on the transaction stack, but all database changes that occurred after that SAVEPOINT was created are rolled back. If the savepoint-name in a ROLLBACK TO command does not match any SAVEPOINT on the stack, then the ROLLBACK command fails with an error and leaves the state of the database unchanged.</p> |
Changes to Doc/Extra/Core/lang_select.html.
|
| | | | | | < | > > > > | > > | > > > > > > > > > | > > > > > > > > > > > > > > > > > | > > > > | > > > > > > > > > > > > > > > > > > | > | > > > | > > > > > | > | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | < < > > > > > | | | | > | > > > > > > > > | < > > > > > > > > | > > | < > | > > | < > | > > > > > > > > | | | > > > > > > > > | > > > > | > > > > > > > > > > > > > > > > > | | | > > > > | > > > > > | > > > > > > > > > > > > > > > > > > > > | > > > > | | > > > > | < < > > > > | < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | > | < | | > > > > > > | > | > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | < | > | | | | | > > > > > > > | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > | > > > > > > > > > > > > > > | > > > > > | > > | | | < > | | > > > | | | | > > > > > > | > > > > > > > | > > > > > > > > > > > > > > | > > > > > | | > > > | | > > > > > > > > > > > > | > > > | | > > > > > > > | < | > > > > > > > | | > > > > | > | > > > > > > > > > > > > > > > | | > | | > | > > > > > | > > > > > > > > > > | > > | | | > > > > > | > > > > | | > > > | > > > > > > | > > > > | > > > > > > > > | > > > > > | > > > > > > > > > > > | > > > > > > > | > > > > > > | > > > > > | | > > | | < | > > > > > > > > | | > | > | > > | | > > > > | > > | < > > > > > > > > > > > > > > > > > > > > > > > > | > > > | < < < > > > > | > > > > > > > > > > > | | | | | | | > > > > > > | > > > > > > > > | < > > > > | < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > | > > > > > > > > > | > > > > > > > > | | > > > | < | | > | > | | > > > > | > > > > > | | > > > > > > > > | > | > > > > | > > > > > > > > > > | | > > > | > > > > > > > > > > > > > | > > > > > > > > | > | | > | > | > > | > > > > > > | > > > > > > > > > > | > > > > > > > > > > | > > > > > > > > > > | > | > | > > > > > > > > > > > > | > | | > > | | | > | > > > | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: SELECT</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>SELECT</h2><p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1157' onclick='hideorshow("x1157","x1158")'>hide</button></p> <blockquote id='x1158'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1159' onclick='hideorshow("x1159","x1160")'>show</button></p> <blockquote id='x1160' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1161' onclick='hideorshow("x1161","x1162")'>show</button></p> <blockquote id='x1162' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x1163' onclick='hideorshow("x1163","x1164")'>show</button></p> <blockquote id='x1164' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x1165' onclick='hideorshow("x1165","x1166")'>show</button></p> <blockquote id='x1166' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x1167' onclick='hideorshow("x1167","x1168")'>show</button></p> <blockquote id='x1168' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1169' onclick='hideorshow("x1169","x1170")'>show</button></p> <blockquote id='x1170' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1171' onclick='hideorshow("x1171","x1172")'>show</button></p> <blockquote id='x1172' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1173' onclick='hideorshow("x1173","x1174")'>show</button></p> <blockquote id='x1174' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1175' onclick='hideorshow("x1175","x1176")'>show</button></p> <blockquote id='x1176' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1177' onclick='hideorshow("x1177","x1178")'>show</button></p> <blockquote id='x1178' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1179' onclick='hideorshow("x1179","x1180")'>show</button></p> <blockquote id='x1180' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1181' onclick='hideorshow("x1181","x1182")'>show</button></p> <blockquote id='x1182' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1183' onclick='hideorshow("x1183","x1184")'>show</button></p> <blockquote id='x1184' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p>The SELECT statement is used to query the database. The result of a SELECT is zero or more rows of data where each row has a fixed number of columns. A SELECT statement does not make any changes to the database. <p>The "<a href="syntaxdiagrams.html#select-stmt">select-stmt</a>" syntax diagram above attempts to show as much of the SELECT statement syntax as possible in a single diagram, because some readers find that helpful. The following "<a href="syntaxdiagrams.html#factored-select-stmt">factored-select-stmt</a>" is an alternative syntax diagrams that expresses the same syntax but tries to break the syntax down into smaller chunks. <p><b><a href="syntaxdiagrams.html#factored-select-stmt">factored-select-stmt:</a></b> <button id='x1185' onclick='hideorshow("x1185","x1186")'>show</button></p> <blockquote id='x1186' style='display:none;'> <img alt="syntax diagram factored-select-stmt" src="images/syntax/factored-select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1187' onclick='hideorshow("x1187","x1188")'>show</button></p> <blockquote id='x1188' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1189' onclick='hideorshow("x1189","x1190")'>show</button></p> <blockquote id='x1190' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1191' onclick='hideorshow("x1191","x1192")'>show</button></p> <blockquote id='x1192' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1193' onclick='hideorshow("x1193","x1194")'>show</button></p> <blockquote id='x1194' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1195' onclick='hideorshow("x1195","x1196")'>show</button></p> <blockquote id='x1196' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1197' onclick='hideorshow("x1197","x1198")'>show</button></p> <blockquote id='x1198' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1199' onclick='hideorshow("x1199","x1200")'>show</button></p> <blockquote id='x1200' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1201' onclick='hideorshow("x1201","x1202")'>show</button></p> <blockquote id='x1202' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x1203' onclick='hideorshow("x1203","x1204")'>show</button></p> <blockquote id='x1204' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x1205' onclick='hideorshow("x1205","x1206")'>show</button></p> <blockquote id='x1206' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x1207' onclick='hideorshow("x1207","x1208")'>show</button></p> <blockquote id='x1208' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1209' onclick='hideorshow("x1209","x1210")'>show</button></p> <blockquote id='x1210' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1211' onclick='hideorshow("x1211","x1212")'>show</button></p> <blockquote id='x1212' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1213' onclick='hideorshow("x1213","x1214")'>show</button></p> <blockquote id='x1214' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1215' onclick='hideorshow("x1215","x1216")'>show</button></p> <blockquote id='x1216' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1217' onclick='hideorshow("x1217","x1218")'>show</button></p> <blockquote id='x1218' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1219' onclick='hideorshow("x1219","x1220")'>show</button></p> <blockquote id='x1220' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1221' onclick='hideorshow("x1221","x1222")'>show</button></p> <blockquote id='x1222' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1223' onclick='hideorshow("x1223","x1224")'>show</button></p> <blockquote id='x1224' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1225' onclick='hideorshow("x1225","x1226")'>show</button></p> <blockquote id='x1226' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-core">select-core:</a></b> <button id='x1227' onclick='hideorshow("x1227","x1228")'>show</button></p> <blockquote id='x1228' style='display:none;'> <img alt="syntax diagram select-core" src="images/syntax/select-core.gif" /> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1229' onclick='hideorshow("x1229","x1230")'>show</button></p> <blockquote id='x1230' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1231' onclick='hideorshow("x1231","x1232")'>show</button></p> <blockquote id='x1232' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1233' onclick='hideorshow("x1233","x1234")'>show</button></p> <blockquote id='x1234' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1235' onclick='hideorshow("x1235","x1236")'>show</button></p> <blockquote id='x1236' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1237' onclick='hideorshow("x1237","x1238")'>show</button></p> <blockquote id='x1238' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1239' onclick='hideorshow("x1239","x1240")'>show</button></p> <blockquote id='x1240' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> </blockquote> </blockquote> </blockquote> </blockquote> <p>Note that there are paths through the syntax diagrams that are not allowed in practice. Some examples: <ul> <li>A <a href="lang_select.html#values">VALUES</a> clause can be the first element in a <a href="lang_select.html#compound">compound SELECT</a> that uses a <a href="lang_with.html">WITH</a> clause, but a <a href="lang_select.html#simpleselect">simple SELECT</a> that consists of just a <a href="lang_select.html#values">VALUES</a> clause cannot be preceded by a <a href="lang_with.html">WITH</a> clause. <li>The <a href="lang_with.html">WITH</a> clause must occur on the first SELECT of a <a href="lang_select.html#compound">compound SELECT</a>. It cannot follow a <a href="syntaxdiagrams.html#compound-operator">compound-operator</a>. </ul> These and other similar syntax restrictions are described in the text. <p>The SELECT statement is the most complicated command in the SQL language. To make the description easier to follow, some of the passages below describe the way the data returned by a SELECT statement is determined as a series of steps. It is important to keep in mind that this is purely illustrative - in practice neither SQLite nor any other SQL engine is required to follow this or any other specific process. <a name="simpleselect"></a> <h3>Simple Select Processing</h3> <p>The core of a SELECT statement is a "simple SELECT" shown by the <a href="syntaxdiagrams.html#select-core">select-core</a> and <a href="syntaxdiagrams.html#simple-select-stmt">simple-select-stmt</a> syntax diagrams below. In practice, most SELECT statements are simple SELECT statements. <p><b><a href="syntaxdiagrams.html#simple-select-stmt">simple-select-stmt:</a></b> <button id='x1241' onclick='hideorshow("x1241","x1242")'>hide</button></p> <blockquote id='x1242'> <img alt="syntax diagram simple-select-stmt" src="images/syntax/simple-select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1243' onclick='hideorshow("x1243","x1244")'>show</button></p> <blockquote id='x1244' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1245' onclick='hideorshow("x1245","x1246")'>show</button></p> <blockquote id='x1246' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1247' onclick='hideorshow("x1247","x1248")'>show</button></p> <blockquote id='x1248' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1249' onclick='hideorshow("x1249","x1250")'>show</button></p> <blockquote id='x1250' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1251' onclick='hideorshow("x1251","x1252")'>show</button></p> <blockquote id='x1252' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1253' onclick='hideorshow("x1253","x1254")'>show</button></p> <blockquote id='x1254' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1255' onclick='hideorshow("x1255","x1256")'>show</button></p> <blockquote id='x1256' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1257' onclick='hideorshow("x1257","x1258")'>show</button></p> <blockquote id='x1258' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x1259' onclick='hideorshow("x1259","x1260")'>show</button></p> <blockquote id='x1260' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x1261' onclick='hideorshow("x1261","x1262")'>show</button></p> <blockquote id='x1262' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x1263' onclick='hideorshow("x1263","x1264")'>show</button></p> <blockquote id='x1264' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1265' onclick='hideorshow("x1265","x1266")'>show</button></p> <blockquote id='x1266' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1267' onclick='hideorshow("x1267","x1268")'>show</button></p> <blockquote id='x1268' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1269' onclick='hideorshow("x1269","x1270")'>show</button></p> <blockquote id='x1270' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1271' onclick='hideorshow("x1271","x1272")'>show</button></p> <blockquote id='x1272' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1273' onclick='hideorshow("x1273","x1274")'>show</button></p> <blockquote id='x1274' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1275' onclick='hideorshow("x1275","x1276")'>show</button></p> <blockquote id='x1276' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1277' onclick='hideorshow("x1277","x1278")'>show</button></p> <blockquote id='x1278' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1279' onclick='hideorshow("x1279","x1280")'>show</button></p> <blockquote id='x1280' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1281' onclick='hideorshow("x1281","x1282")'>show</button></p> <blockquote id='x1282' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1283' onclick='hideorshow("x1283","x1284")'>show</button></p> <blockquote id='x1284' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-core">select-core:</a></b> <button id='x1285' onclick='hideorshow("x1285","x1286")'>hide</button></p> <blockquote id='x1286'> <img alt="syntax diagram select-core" src="images/syntax/select-core.gif" /> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1287' onclick='hideorshow("x1287","x1288")'>show</button></p> <blockquote id='x1288' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1289' onclick='hideorshow("x1289","x1290")'>show</button></p> <blockquote id='x1290' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1291' onclick='hideorshow("x1291","x1292")'>show</button></p> <blockquote id='x1292' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1293' onclick='hideorshow("x1293","x1294")'>show</button></p> <blockquote id='x1294' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1295' onclick='hideorshow("x1295","x1296")'>show</button></p> <blockquote id='x1296' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1297' onclick='hideorshow("x1297","x1298")'>show</button></p> <blockquote id='x1298' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1299' onclick='hideorshow("x1299","x1300")'>show</button></p> <blockquote id='x1300' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> <p>Generating the results of a simple SELECT statement is presented as a four step process in the description below: <ol> <li> <p><a href="lang_select.html#fromclause">FROM clause</a> processing: The input data for the simple SELECT is determined. The input data is either implicitly a single row with 0 columns (if there is no FROM clause) or is determined by the FROM clause. <li> <p><a href="lang_select.html#whereclause">WHERE clause</a> processing: The input data is filtered using the WHERE clause expression. <li> <p><a href="lang_select.html#resultset">GROUP BY, HAVING and result-column expression</a> processing: The set of result rows is computed by aggregating the data according to any GROUP BY clause and calculating the result-set expressions for the rows of the filtered input dataset. <li> <p><a href="lang_select.html#distinct">DISTINCT/ALL keyword</a> processing: If the query is a "SELECT DISTINCT" query, duplicate rows are removed from the set of result rows. </ol> <p>There are two types of simple SELECT statement - aggregate and non-aggregate queries. A simple SELECT statement is an aggregate query if it contains either a GROUP BY clause or one or more aggregate functions in the result-set. Otherwise, if a simple SELECT contains no aggregate functions or a GROUP BY clause, it is a non-aggregate query. <p><b>1. Determination of input data (FROM clause processing).</b> <a name="fromclause"></a> <p>The input data used by a simple SELECT query is a set of <i>N</i> rows each <i>M</i> columns wide. <p>If the FROM clause is omitted from a simple SELECT statement, then the input data is implicitly a single row zero columns wide (i.e. <i>N</i>=1 and <i>M</i>=0). <p>If a FROM clause is specified, the data on which a simple SELECT query operates comes from the one or more tables or subqueries (SELECT statements in parenthesis) specified following the FROM keyword. A subquery specified in the table-or-subquery following the FROM clause in a simple SELECT statement is handled as if it was a table containing the data returned by executing the subquery statement. Each column of the subquery has the <a href="datatype3.html#collation">collation sequence</a> and <a href="datatype3.html#affinity">affinity</a> of the corresponding expression in the subquery statement. <p>If there is only a single table or subquery in the FROM clause, then the input data used by the SELECT statement is the contents of the named table. If there is more than one table or subquery in FROM clause then the contents of all tables and/or subqueries are joined into a single dataset for the simple SELECT statement to operate on. Exactly how the data is combined depends on the specific <a href="syntaxdiagrams.html#join-operator">join-operator</a> and <a href="syntaxdiagrams.html#join-constraint">join-constraint</a> used to connect the tables or subqueries together. <p>All joins in SQLite are based on the cartesian product of the left and right-hand datasets. The columns of the cartesian product dataset are, in order, all the columns of the left-hand dataset followed by all the columns of the right-hand dataset. There is a row in the cartesian product dataset formed by combining each unique combination of a row from the left-hand and right-hand datasets. In other words, if the left-hand dataset consists of <i>N<sub><small>left</small></sub></i> rows of <i>M<sub><small>left</small></sub></i> columns, and the right-hand dataset of <i>N<sub><small>right</small></sub></i> rows of <i>M<sub><small>right</small></sub></i> columns, then the cartesian product is a dataset of <i>N<sub><small>left</small></sub>×N<sub><small>right</small></sub></i> rows, each containing <i>M<sub><small>left</small></sub>+M<sub><small>right</small></sub></i> columns. <p>If the join-operator is "CROSS JOIN", "INNER JOIN", "JOIN" or a comma (",") and there is no ON or USING clause, then the result of the join is simply the cartesian product of the left and right-hand datasets. If join-operator does have ON or USING clauses, those are handled according to the following bullet points: <ul> <li> <p>If there is an ON clause then the ON expression is evaluated for each row of the cartesian product as a <a href="lang_expr.html#booleanexpr">boolean expression</a>. Only rows for which the expression evaluates to true are included from the dataset. <li> <p>If there is a USING clause then each of the column names specified must exist in the datasets to both the left and right of the join-operator. For each pair of named columns, the expression "lhs.X = rhs.X" is evaluated for each row of the cartesian product as a <a href="lang_expr.html#booleanexpr">boolean expression</a>. Only rows for which all such expressions evaluates to true are included from the result set. When comparing values as a result of a USING clause, the normal rules for handling affinities, collation sequences and NULL values in comparisons apply. The column from the dataset on the left-hand side of the join-operator is considered to be on the left-hand side of the comparison operator (=) for the purposes of collation sequence and affinity precedence. <p>For each pair of columns identified by a USING clause, the column from the right-hand dataset is omitted from the joined dataset. This is the only difference between a USING clause and its equivalent ON constraint. <li> <p>If the NATURAL keyword is in the join-operator then an implicit USING clause is added to the join-constraints. The implicit USING clause contains each of the column names that appear in both the left and right-hand input datasets. If the left and right-hand input datasets feature no common column names, then the NATURAL keyword has no effect on the results of the join. A USING or ON clause may not be added to a join that specifies the NATURAL keyword. <li> <p>If the join-operator is a "LEFT JOIN" or "LEFT OUTER JOIN", then after the ON or USING filtering clauses have been applied, an extra row is added to the output for each row in the original left-hand input dataset that corresponds to no rows at all in the composite dataset (if any). The added rows contain NULL values in the columns that would normally contain values copied from the right-hand input dataset. </ul> <p>When more than two tables are joined together as part of a FROM clause, the join operations are processed in order from left to right. In other words, the FROM clause (A join-op-1 B join-op-2 C) is computed as ((A join-op-1 B) join-op-2 C). <a name="crossjoin"></a> <p><b>Side note: Special handling of CROSS JOIN.</b> There is no difference between the "INNER JOIN", "JOIN" and "," join operators. They are completely interchangeable in SQLite. The "CROSS JOIN" join operator produces the same result as the "INNER JOIN", "JOIN" and "," operators, but is <a href="optoverview.html#crossjoin">handled differently by the query optimizer</a> in that it prevents the query optimizer from reordering the tables in the join. An application programmer can use the CROSS JOIN operator to directly influence the algorithm that is chosen to implement the SELECT statement. Avoid using CROSS JOIN except in specific situations where manual control of the query optimizer is desired. Avoid using CROSS JOIN early in the development of an application as doing so is a <a href="http://c2.com/cgi/wiki?PrematureOptimization">premature optimization</a>. The special handling of CROSS JOIN is an SQLite-specific feature and is not a part of standard SQL. <a name="whereclause"></a> <p><b>2. WHERE clause filtering.</b> <p>If a WHERE clause is specified, the WHERE expression is evaluated for each row in the input data as a <a href="lang_expr.html#booleanexpr">boolean expression</a>. Only rows for which the WHERE clause expression evaluates to true are included from the dataset before continuing. Rows are excluded from the result if the WHERE clause evaluates to either false or NULL. <p>For a JOIN or INNER JOIN or CROSS JOIN, there is no difference between a constraint expression in the WHERE clause and one in the ON clause. However, for a LEFT JOIN or LEFT OUTER JOIN, the difference is very important. In a LEFT JOIN, the extra NULL row for the right-hand table is added after ON clause processing but before WHERE clause processing. A constraint of the form "left.x=right.y" in an ON clause will therefore allow through the added all-NULL rows of the right table. But if that same constraint is in the WHERE clause a NULL in "right.y" will prevent the expression "left.x=right.y" from being true, and thus exclude that row from the output. <p><b>3. Generation of the set of result rows.</b> <a name="resultset"></a> <p>Once the input data from the FROM clause has been filtered by the WHERE clause expression (if any), the set of result rows for the simple SELECT are calculated. Exactly how this is done depends on whether the simple SELECT is an aggregate or non-aggregate query, and whether or not a GROUP BY clause was specified. <p> The list of expressions between the SELECT and FROM keywords is known as the result expression list. If a result expression is the special expression "*" then all columns in the input data are substituted for that one expression. If the expression is the alias of a table or subquery in the FROM clause followed by ".*" then all columns from the named table or subquery are substituted for the single expression. It is an error to use a "*" or "alias.*" expression in any context other than a result expression list. It is also an error to use a "*" or "alias.*" expression in a simple SELECT query that does not have a FROM clause. <p> The number of columns in the rows returned by a simple SELECT statement is equal to the number of expressions in the result expression list after substitution of * and alias.* expressions. Each result row is calculated by evaluating the expressions in the result expression list with respect to a single row of input data or, for aggregate queries, with respect to a group of rows. <ul> <li><p>If the SELECT statement is <b>a non-aggregate query</b>, then each expression in the result expression list is evaluated for each row in the dataset filtered by the WHERE clause. <li><p>If the SELECT statement is <b>an aggregate query without a GROUP BY</b> clause, then each aggregate expression in the result-set is evaluated once across the entire dataset. Each non-aggregate expression in the result-set is evaluated once for an arbitrarily selected row of the dataset. The same arbitrarily selected row is used for each non-aggregate expression. Or, if the dataset contains zero rows, then each non-aggregate expression is evaluated against a row consisting entirely of NULL values. <p>The single row of result-set data created by evaluating the aggregate and non-aggregate expressions in the result-set forms the result of an aggregate query without a GROUP BY clause. An aggregate query without a GROUP BY clause always returns exactly one row of data, even if there are zero rows of input data. <li><p>If the SELECT statement is <b>an aggregate query with a GROUP BY</b> clause, then each of the expressions specified as part of the GROUP BY clause is evaluated for each row of the dataset. Each row is then assigned to a "group" based on the results; rows for which the results of evaluating the GROUP BY expressions are the same get assigned to the same group. For the purposes of grouping rows, NULL values are considered equal. The usual rules for <a href="datatype3.html#collation">selecting a collation sequence</a> with which to compare text values apply when evaluating expressions in a GROUP BY clause. The expressions in the GROUP BY clause do <em>not</em> have to be expressions that appear in the result. The expressions in a GROUP BY clause may not be aggregate expressions. <p>If a HAVING clause is specified, it is evaluated once for each group of rows as a <a href="lang_expr.html#booleanexpr">boolean expression</a>. If the result of evaluating the HAVING clause is false, the group is discarded. If the HAVING clause is an aggregate expression, it is evaluated across all rows in the group. If a HAVING clause is a non-aggregate expression, it is evaluated with respect to an arbitrarily selected row from the group. The HAVING expression may refer to values, even aggregate functions, that are not in the result.</p> <p>Each expression in the result-set is then evaluated once for each group of rows. If the expression is an aggregate expression, it is evaluated across all rows in the group. Otherwise, it is evaluated against a single arbitrarily chosen row from within the group. If there is more than one non-aggregate expression in the result-set, then all such expressions are evaluated for the same row. <p>Each group of input dataset rows contributes a single row to the set of result rows. Subject to filtering associated with the DISTINCT keyword, the number of rows returned by an aggregate query with a GROUP BY clause is the same as the number of groups of rows produced by applying the GROUP BY and HAVING clauses to the filtered input dataset. </ul> <p><b>4. Removal of duplicate rows (DISTINCT processing).</b> <a name="distinct"></a> <p>One of the ALL or DISTINCT keywords may follow the SELECT keyword in a simple SELECT statement. If the simple SELECT is a SELECT ALL, then the entire set of result rows are returned by the SELECT. If neither ALL or DISTINCT are present, then the behavior is as if ALL were specified. If the simple SELECT is a SELECT DISTINCT, then duplicate rows are removed from the set of result rows before it is returned. For the purposes of detecting duplicate rows, two NULL values are considered to be equal. The normal rules for selecting a collation sequence to compare text values with apply. <a name="compound"></a> <h3>Compound Select Statements</h3> <p>Two or more <a href="lang_select.html#simpleselect">simple SELECT</a> statements may be connected together to form a compound SELECT using the UNION, UNION ALL, INTERSECT or EXCEPT operator, as shown by the following diagram: <p><b><a href="syntaxdiagrams.html#compound-select-stmt">compound-select-stmt:</a></b> <button id='x1301' onclick='hideorshow("x1301","x1302")'>hide</button></p> <blockquote id='x1302'> <img alt="syntax diagram compound-select-stmt" src="images/syntax/compound-select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1303' onclick='hideorshow("x1303","x1304")'>show</button></p> <blockquote id='x1304' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1305' onclick='hideorshow("x1305","x1306")'>show</button></p> <blockquote id='x1306' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1307' onclick='hideorshow("x1307","x1308")'>show</button></p> <blockquote id='x1308' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1309' onclick='hideorshow("x1309","x1310")'>show</button></p> <blockquote id='x1310' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1311' onclick='hideorshow("x1311","x1312")'>show</button></p> <blockquote id='x1312' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1313' onclick='hideorshow("x1313","x1314")'>show</button></p> <blockquote id='x1314' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1315' onclick='hideorshow("x1315","x1316")'>show</button></p> <blockquote id='x1316' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1317' onclick='hideorshow("x1317","x1318")'>show</button></p> <blockquote id='x1318' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x1319' onclick='hideorshow("x1319","x1320")'>show</button></p> <blockquote id='x1320' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x1321' onclick='hideorshow("x1321","x1322")'>show</button></p> <blockquote id='x1322' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x1323' onclick='hideorshow("x1323","x1324")'>show</button></p> <blockquote id='x1324' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1325' onclick='hideorshow("x1325","x1326")'>show</button></p> <blockquote id='x1326' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1327' onclick='hideorshow("x1327","x1328")'>show</button></p> <blockquote id='x1328' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1329' onclick='hideorshow("x1329","x1330")'>show</button></p> <blockquote id='x1330' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1331' onclick='hideorshow("x1331","x1332")'>show</button></p> <blockquote id='x1332' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1333' onclick='hideorshow("x1333","x1334")'>show</button></p> <blockquote id='x1334' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1335' onclick='hideorshow("x1335","x1336")'>show</button></p> <blockquote id='x1336' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1337' onclick='hideorshow("x1337","x1338")'>show</button></p> <blockquote id='x1338' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1339' onclick='hideorshow("x1339","x1340")'>show</button></p> <blockquote id='x1340' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1341' onclick='hideorshow("x1341","x1342")'>show</button></p> <blockquote id='x1342' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1343' onclick='hideorshow("x1343","x1344")'>show</button></p> <blockquote id='x1344' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-core">select-core:</a></b> <button id='x1345' onclick='hideorshow("x1345","x1346")'>show</button></p> <blockquote id='x1346' style='display:none;'> <img alt="syntax diagram select-core" src="images/syntax/select-core.gif" /> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1347' onclick='hideorshow("x1347","x1348")'>show</button></p> <blockquote id='x1348' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1349' onclick='hideorshow("x1349","x1350")'>show</button></p> <blockquote id='x1350' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1351' onclick='hideorshow("x1351","x1352")'>show</button></p> <blockquote id='x1352' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1353' onclick='hideorshow("x1353","x1354")'>show</button></p> <blockquote id='x1354' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1355' onclick='hideorshow("x1355","x1356")'>show</button></p> <blockquote id='x1356' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1357' onclick='hideorshow("x1357","x1358")'>show</button></p> <blockquote id='x1358' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1359' onclick='hideorshow("x1359","x1360")'>show</button></p> <blockquote id='x1360' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> <p>In a compound SELECT, all the constituent SELECTs must return the same number of result columns. As the components of a compound SELECT must be simple SELECT statements, they may not contain <a href="lang_select.html#orderby">ORDER BY</a> or <a href="lang_select.html#limitoffset">LIMIT</a> clauses. <a href="lang_select.html#orderby">ORDER BY</a> and <a href="lang_select.html#limitoffset">LIMIT</a> clauses may only occur at the end of the entire compound SELECT, and then only if the final element of the compound is not a <a href="lang_select.html#values">VALUES</a> clause. <p>A compound SELECT created using UNION ALL operator returns all the rows from the SELECT to the left of the UNION ALL operator, and all the rows from the SELECT to the right of it. The UNION operator works the same way as UNION ALL, except that duplicate rows are removed from the final result set. The INTERSECT operator returns the intersection of the results of the left and right SELECTs. The EXCEPT operator returns the subset of rows returned by the left SELECT that are not also returned by the right-hand SELECT. Duplicate rows are removed from the results of INTERSECT and EXCEPT operators before the result set is returned. <p>For the purposes of determining duplicate rows for the results of compound SELECT operators, NULL values are considered equal to other NULL values and distinct from all non-NULL values. The collation sequence used to compare two text values is determined as if the columns of the left and right-hand SELECT statements were the left and right-hand operands of the equals (=) operator, except that greater precedence is not assigned to a collation sequence specified with the postfix COLLATE operator. No affinity transformations are applied to any values when comparing rows as part of a compound SELECT. <p>When three or more simple SELECTs are connected into a compound SELECT, they group from left to right. In other words, if "A", "B" and "C" are all simple SELECT statements, (A op B op C) is processed as ((A op B) op C). </p> <a name="orderby"></a> <h3>The ORDER BY clause</h3> <p>If a SELECT statement that returns more than one row does not have an ORDER BY clause, the order in which the rows are returned is undefined. Or, if a SELECT statement does have an ORDER BY clause, then the list of expressions attached to the ORDER BY determine the order in which rows are returned to the user. <p> In a <a href="lang_select.html#compound">compound SELECT</a> statement, only the last or right-most <a href="lang_select.html#simpleselect">simple SELECT</a> may have an ORDER BY clause. That ORDER BY clause will apply across all elements of the compound. If the right-most element of a <a href="lang_select.html#compound">compound SELECT</a> is a <a href="lang_select.html#values">VALUES</a> clause, then no ORDER BY clause is allowed on that statement. <p>Rows are first sorted based on the results of evaluating the left-most expression in the ORDER BY list, then ties are broken by evaluating the second left-most expression and so on. The order in which two rows for which all ORDER BY expressions evaluate to equal values are returned is undefined. Each ORDER BY expression may be optionally followed by one of the keywords ASC (smaller values are returned first) or DESC (larger values are returned first). If neither ASC or DESC are specified, rows are sorted in ascending (smaller values first) order by default. <p>Each ORDER BY expression is processed as follows:</p> <ol> <li><p>If the ORDER BY expression is a constant integer K then the expression is considered an alias for the K-th column of the result set (columns are numbered from left to right starting with 1). <li><p>If the ORDER BY expression is an identifier that corresponds to the alias of one of the output columns, then the expression is considered an alias for that column. <li><p>Otherwise, if the ORDER BY expression is any other expression, it is evaluated and the returned value used to order the output rows. If the SELECT statement is a simple SELECT, then an ORDER BY may contain any arbitrary expressions. However, if the SELECT is a compound SELECT, then ORDER BY expressions that are not aliases to output columns must be exactly the same as an expression used as an output column. </ol> <p>For the purposes of sorting rows, values are compared in the same way as for <a href="datatype3.html#comparisons">comparison expressions</a>. The collation sequence used to compare two text values is determined as follows: <ol> <li><p>If the ORDER BY expression is assigned a collation sequence using the postfix <a href="lang_expr.html#collateop">COLLATE operator</a>, then the specified collation sequence is used. <li><p>Otherwise, if the ORDER BY expression is an alias to an expression that has been assigned a collation sequence using the postfix <a href="lang_expr.html#collateop">COLLATE operator</a>, then the collation sequence assigned to the aliased expression is used. <li><p>Otherwise, if the ORDER BY expression is a column or an alias of an expression that is a column, then the default collation sequence for the column is used. <li><p>Otherwise, the <a href="datatype3.html#collation">BINARY</a> collation sequence is used. </ol> <p>In a <a href="lang_select.html#compound">compound SELECT</a> statement, all ORDER BY expressions are handled as aliases for one of the result columns of the compound. If an ORDER BY expression is not an integer alias, then SQLite searches the left-most SELECT in the compound for a result column that matches either the second or third rules above. If a match is found, the search stops and the expression is handled as an alias for the result column that it has been matched against. Otherwise, the next SELECT to the right is tried, and so on. If no matching expression can be found in the result columns of any constituent SELECT, it is an error. Each term of the ORDER BY clause is processed separately and may be matched against result columns from different SELECT statements in the compound.</p> <a name="limitoffset"></a> <h3>The LIMIT clause</h3> <p>The LIMIT clause is used to place an upper bound on the number of rows returned by the entire SELECT statement. <p>In a <a href="lang_select.html#compound">compound SELECT</a>, only the last or right-most <a href="lang_select.html#simpleselect">simple SELECT</a> may contain a LIMIT clause. In a <a href="lang_select.html#compound">compound SELECT</a>, the LIMIT clause applies to the entire compound, not just the final SELECT. If the right-most <a href="lang_select.html#simpleselect">simple SELECT</a> is a <a href="lang_select.html#values">VALUES clause</a> then no LIMIT clause is allowed. <p>Any scalar expression may be used in the LIMIT clause, so long as it evaluates to an integer or a value that can be losslessly converted to an integer. If the expression evaluates to a NULL value or any other value that cannot be losslessly converted to an integer, an error is returned. If the LIMIT expression evaluates to a negative value, then there is no upper bound on the number of rows returned. Otherwise, the SELECT returns the first N rows of its result set only, where N is the value that the LIMIT expression evaluates to. Or, if the SELECT statement would return less than N rows without a LIMIT clause, then the entire result set is returned. <p>The expression attached to the optional OFFSET clause that may follow a LIMIT clause must also evaluate to an integer, or a value that can be losslessly converted to an integer. If an expression has an OFFSET clause, then the first M rows are omitted from the result set returned by the SELECT statement and the next N rows are returned, where M and N are the values that the OFFSET and LIMIT clauses evaluate to, respectively. Or, if the SELECT would return less than M+N rows if it did not have a LIMIT clause, then the first M rows are skipped and the remaining rows (if any) are returned. If the OFFSET clause evaluates to a negative value, the results are the same as if it had evaluated to zero. <p>Instead of a separate OFFSET clause, the LIMIT clause may specify two scalar expressions separated by a comma. In this case, the first expression is used as the OFFSET expression and the second as the LIMIT expression. This is counter-intuitive, as when using the OFFSET clause the second of the two expressions is the OFFSET and the first the LIMIT. This reversal of the offset and limit is intentional - it maximizes compatibility with other SQL database systems. However, to avoid confusion, programmers are strongly encouraged to use the form of the LIMIT clause that uses the "OFFSET" keyword and avoid using a LIMIT clause with a comma-separated offset. <a name="values"></a> <h3>The VALUES clause</h3> <p>The phrase "VALUES(<i>expr-list</i>)" means the same thing as "SELECT <i>expr-list</i>". The phrase "VALUES(<i>expr-list-1</i>),...,(<i>expr-list-N</i>)" means the same thing as "SELECT <i>expr-list-1</i> UNION ALL ... UNION ALL SELECT <i>expr-list-N</i>". There is no advantage to using one form over the other. Both forms yield the same result and both forms use the same amount of memory and processing time. <p>There are some restrictions on the use of a VALUES clause that are not shown on the syntax diagrams: <ul> <li><p> A VALUES clause cannot be followed by <a href="lang_select.html#orderby">ORDER BY</a> or <a href="lang_select.html#limitoffset">LIMIT</a>. <li><p> A VALUES clause cannot be used together with a <a href="lang_with.html">WITH</a> clause in a <a href="lang_select.html#simpleselect">simple SELECT</a>. </ul> <h3>The WITH Clause</h3> <p>SELECT statements may be optionally preceded by a single <a href="lang_with.html">WITH clause</a> that defines one or more <a href="lang_with.html">common table expressions</a> for use within the SELECT statement. |
Changes to Doc/Extra/Core/lang_transaction.html.
|
| | | | | | < | > > | > | > > | > | < | < | < > | | > > | > | < < > > > > > > | > | | | < > | | | | | > > > | > | > > | > > > > > > > > | > > | > | | | | < < < < < < | > | > > > > > | | < | < < < < < | | | | | | | | < < < | | > > > | | > > > > > > > > < < > > | | | | | > | > | > > > | < < | < < < > > > > > > | | | > | < > | > > | | | | | | | > | | > | | | > | > | | | | > | > > | > > > > > > > > > > | > > > > > > > | > | | > | | | | | > | > | | | > | | > | > | < > > > > > > | | > | > > > > > | > > > > | < > | > | > | < > | < > > | > | > > > | > | > | | | < | > | > > > > | | | > > > > > > > > | | > > > | | > > > > > | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: BEGIN TRANSACTION</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>BEGIN TRANSACTION</h2><p><b><a href="syntaxdiagrams.html#begin-stmt">begin-stmt:</a></b> <button id='x801' onclick='hideorshow("x801","x802")'>hide</button></p> <blockquote id='x802'> <img alt="syntax diagram begin-stmt" src="images/syntax/begin-stmt.gif" /> </blockquote> <p> No changes can be made to the database except within a transaction. Any command that changes the database (basically, any SQL command other than <a href="lang_select.html">SELECT</a>) will automatically start a transaction if one is not already in effect. Automatically started transactions are committed when the last query finishes. </p> <p> Transactions can be started manually using the BEGIN command. Such transactions usually persist until the next COMMIT or ROLLBACK command. But a transaction will also ROLLBACK if the database is closed or if an error occurs and the ROLLBACK conflict resolution algorithm is specified. See the documentation on the <a href="lang_conflict.html">ON CONFLICT</a> clause for additional information about the ROLLBACK conflict resolution algorithm. </p> <p> END TRANSACTION is an alias for COMMIT. </p> <p> Transactions created using BEGIN...COMMIT do not nest. For nested transactions, use the <a href="lang_savepoint.html">SAVEPOINT</a> and <a href="lang_savepoint.html">RELEASE</a> commands. The "TO SAVEPOINT <i>name</i>" clause of the ROLLBACK command shown in the syntax diagram above is only applicable to <a href="lang_savepoint.html">SAVEPOINT</a> transactions. An attempt to invoke the BEGIN command within a transaction will fail with an error, regardless of whether the transaction was started by <a href="lang_savepoint.html">SAVEPOINT</a> or a prior BEGIN. The COMMIT command and the ROLLBACK command without the TO clause work the same on <a href="lang_savepoint.html">SAVEPOINT</a> transactions as they do with transactions started by BEGIN.</p> <a name="immediate"></a> <p> Transactions can be deferred, immediate, or exclusive. The default transaction behavior is deferred. Deferred means that no locks are acquired on the database until the database is first accessed. Thus with a deferred transaction, the BEGIN statement itself does nothing to the filesystem. Locks are not acquired until the first read or write operation. The first read operation against a database creates a <a href="lockingv3.html#shared_lock">SHARED</a> lock and the first write operation creates a <a href="lockingv3.html#reserved_lock">RESERVED</a> lock. Because the acquisition of locks is deferred until they are needed, it is possible that another thread or process could create a separate transaction and write to the database after the BEGIN on the current thread has executed. If the transaction is immediate, then <a href="lockingv3.html#reserved_lock">RESERVED</a> locks are acquired on all databases as soon as the BEGIN command is executed, without waiting for the database to be used. After a BEGIN IMMEDIATE, no other <a href="c3ref/sqlite3.html">database connection</a> will be able to write to the database or do a BEGIN IMMEDIATE or BEGIN EXCLUSIVE. Other processes can continue to read from the database, however. An exclusive transaction causes <a href="lockingv3.html#excl_lock">EXCLUSIVE</a> locks to be acquired on all databases. After a BEGIN EXCLUSIVE, no other <a href="c3ref/sqlite3.html">database connection</a> except for <a href="pragma.html#pragma_read_uncommitted">read_uncommitted</a> connections will be able to read the database and no other connection without exception will be able to write the database until the transaction is complete. </p> <p> An implicit transaction (a transaction that is started automatically, not a transaction started by BEGIN) is committed automatically when the last active statement finishes. A statement finishes when its prepared statement is <a href="c3ref/reset.html">reset</a> or <a href="c3ref/finalize.html">finalized</a>. An open <a href="c3ref/blob.html">sqlite3_blob</a> used for incremental BLOB I/O counts as an unfinished statement. The <a href="c3ref/blob.html">sqlite3_blob</a> finishes when it is <a href="c3ref/blob_close.html">closed</a>. </p> <p> The explicit COMMIT command runs immediately, even if there are pending <a href="lang_select.html">SELECT</a> statements. However, if there are pending write operations, the COMMIT command will fail with an error code <a href="c3ref/c_abort.html">SQLITE_BUSY</a>. </p> <p> An attempt to execute COMMIT might also result in an <a href="c3ref/c_abort.html">SQLITE_BUSY</a> return code if an another thread or process has a <a href="lockingv3.html#shared_lock">shared lock</a> on the database that prevented the database from being updated. When COMMIT fails in this way, the transaction remains active and the COMMIT can be retried later after the reader has had a chance to clear. </p> <p> The ROLLBACK will fail with an error code <a href="c3ref/c_abort.html">SQLITE_BUSY</a> if there are any pending queries. Both read-only and read/write queries will cause a ROLLBACK to fail. A ROLLBACK must fail if there are pending read operations (unlike COMMIT which can succeed) because bad things will happen if the in-memory image of the database is changed out from under an active query. </p> <p> If <a href="pragma.html#pragma_journal_mode">PRAGMA journal_mode</a> is set to OFF (thus disabling the rollback journal file) then the behavior of the ROLLBACK command is undefined. </p> <h3>Response To Errors Within A Transaction</h3> <p> If certain kinds of errors occur within a transaction, the transaction may or may not be rolled back automatically. The errors that can cause an automatic rollback include:</p> <ul> <li> <a href="c3ref/c_abort.html">SQLITE_FULL</a>: database or disk full <li> <a href="c3ref/c_abort.html">SQLITE_IOERR</a>: disk I/O error <li> <a href="c3ref/c_abort.html">SQLITE_BUSY</a>: database in use by another process <li> <a href="c3ref/c_abort.html">SQLITE_NOMEM</a>: out or memory <li> <a href="c3ref/c_abort.html">SQLITE_INTERRUPT</a>: processing <a href="c3ref/interrupt.html">interrupted</a> by application request </ul> <p> For all of these errors, SQLite attempts to undo just the one statement it was working on and leave changes from prior statements within the same transaction intact and continue with the transaction. However, depending on the statement being evaluated and the point at which the error occurs, it might be necessary for SQLite to rollback and cancel the entire transaction. An application can tell which course of action SQLite took by using the <a href="c3ref/get_autocommit.html">sqlite3_get_autocommit()</a> C-language interface.</p> <p>It is recommended that applications respond to the errors listed above by explicitly issuing a ROLLBACK command. If the transaction has already been rolled back automatically by the error response, then the ROLLBACK command will fail with an error, but no harm is caused by this.</p> <p>Future versions of SQLite may extend the list of errors which might cause automatic transaction rollback. Future versions of SQLite might change the error response. In particular, we may choose to simplify the interface in future versions of SQLite by causing the errors above to force an unconditional rollback.</p> |
Deleted Doc/Extra/Core/lang_types.html.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to Doc/Extra/Core/lang_update.html.
|
| | | | | | < | > > > > | > > | > > > > > > > > > | > > > > > > > > > | > > > > > > > | > > > > | > > > > > > > > > > > > > > > > > > | | | | > > | > > > > > | > | > | | | > > | > | > > > > > > > > > > > > > > > > > > > > > > > | > > > > | | < < | > > > > | | > | > | < > | > > > > > > > > > > | > > > > | > > > > > > > > | > > > > | > > | > > > | < < < > | < < > > > > | < < | > > | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < > > > > | > > > > > > > > | < < > > > > | < < | > > > > | > > > > | > > > > > > > > | | | > > | > > > > > > > > > | | | > > > > | | < > | | > > > > > > > > > > > > > > > > > > | > > | > > | | > | > > > | > > > | | > > > | > > > > > > > | > > > > | > > > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: UPDATE</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>UPDATE</h2><p><b><a href="syntaxdiagrams.html#update-stmt">update-stmt:</a></b> <button id='x1361' onclick='hideorshow("x1361","x1362")'>hide</button></p> <blockquote id='x1362'> <img alt="syntax diagram update-stmt" src="images/syntax/update-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x1363' onclick='hideorshow("x1363","x1364")'>show</button></p> <blockquote id='x1364' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x1365' onclick='hideorshow("x1365","x1366")'>show</button></p> <blockquote id='x1366' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x1367' onclick='hideorshow("x1367","x1368")'>show</button></p> <blockquote id='x1368' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1369' onclick='hideorshow("x1369","x1370")'>show</button></p> <blockquote id='x1370' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1371' onclick='hideorshow("x1371","x1372")'>show</button></p> <blockquote id='x1372' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1373' onclick='hideorshow("x1373","x1374")'>show</button></p> <blockquote id='x1374' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1375' onclick='hideorshow("x1375","x1376")'>show</button></p> <blockquote id='x1376' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1377' onclick='hideorshow("x1377","x1378")'>show</button></p> <blockquote id='x1378' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1379' onclick='hideorshow("x1379","x1380")'>show</button></p> <blockquote id='x1380' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1381' onclick='hideorshow("x1381","x1382")'>show</button></p> <blockquote id='x1382' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1383' onclick='hideorshow("x1383","x1384")'>show</button></p> <blockquote id='x1384' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1385' onclick='hideorshow("x1385","x1386")'>show</button></p> <blockquote id='x1386' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1387' onclick='hideorshow("x1387","x1388")'>show</button></p> <blockquote id='x1388' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1389' onclick='hideorshow("x1389","x1390")'>show</button></p> <blockquote id='x1390' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#qualified-table-name">qualified-table-name:</a></b> <button id='x1391' onclick='hideorshow("x1391","x1392")'>show</button></p> <blockquote id='x1392' style='display:none;'> <img alt="syntax diagram qualified-table-name" src="images/syntax/qualified-table-name.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#with-clause">with-clause:</a></b> <button id='x1393' onclick='hideorshow("x1393","x1394")'>show</button></p> <blockquote id='x1394' style='display:none;'> <img alt="syntax diagram with-clause" src="images/syntax/with-clause.gif" /> <p><b><a href="syntaxdiagrams.html#cte-table-name">cte-table-name:</a></b> <button id='x1395' onclick='hideorshow("x1395","x1396")'>show</button></p> <blockquote id='x1396' style='display:none;'> <img alt="syntax diagram cte-table-name" src="images/syntax/cte-table-name.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1397' onclick='hideorshow("x1397","x1398")'>show</button></p> <blockquote id='x1398' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1399' onclick='hideorshow("x1399","x1400")'>show</button></p> <blockquote id='x1400' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1401' onclick='hideorshow("x1401","x1402")'>show</button></p> <blockquote id='x1402' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1403' onclick='hideorshow("x1403","x1404")'>show</button></p> <blockquote id='x1404' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1405' onclick='hideorshow("x1405","x1406")'>show</button></p> <blockquote id='x1406' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1407' onclick='hideorshow("x1407","x1408")'>show</button></p> <blockquote id='x1408' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1409' onclick='hideorshow("x1409","x1410")'>show</button></p> <blockquote id='x1410' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1411' onclick='hideorshow("x1411","x1412")'>show</button></p> <blockquote id='x1412' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1413' onclick='hideorshow("x1413","x1414")'>show</button></p> <blockquote id='x1414' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> </blockquote> </blockquote> <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 the result of evaluating the WHERE clause expression as a <a href="lang_expr.html#booleanexpr">boolean expression is true</a>. It is not an error if the WHERE clause does not evaluate to true 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 occurrence 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 <a href="lang_conflict.html">ON CONFLICT</a> 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 <a href="lang_createtrigger.html">CREATE TRIGGER</a> statement. <ul> <li><p>The <i>table-name</i> specified as part of an UPDATE statement within a trigger body 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. Unless the table to which the trigger is attached is in the TEMP database, the table being updated by the trigger program must reside in the same database as it. If the table to which the trigger is attached is in the TEMP database, then the unqualified name of the table being updated is resolved in the same way as it is for a top-level statement (by searching first the TEMP database, then the main database, then any other databases in the order they were 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 <a href="compile.html#enable_update_delete_limit">SQLITE_ENABLE_UPDATE_DELETE_LIMIT</a> compile-time option then the syntax of the UPDATE statement is extended with optional ORDER BY and LIMIT clauses as follows:</p> <p><b><a href="syntaxdiagrams.html#update-stmt-limited">update-stmt-limited:</a></b></p><blockquote> <img alt="syntax diagram update-stmt-limited" src="images/syntax/update-stmt-limited.gif"></img> </blockquote> <p>If an UPDATE statement has a LIMIT clause, the maximum number of rows that will be updated is found by evaluating the accompanying expression and casting it to an integer value. A negative value is interpreted as "no limit". <p>If the LIMIT expression evaluates to non-negative value <i>N</i> and the UPDATE statement has an ORDER BY clause, then all rows that would be updated in the absence of the LIMIT clause are sorted according to the ORDER BY and the first <i>N</i> updated. If the UPDATE statement also has an OFFSET clause, then it is similarly evaluated and cast to an integer value. If the OFFSET expression evaluates to a non-negative value <i>M</i>, then the first <i>M</i> rows are skipped and the following <i>N</i> rows updated instead. <p>If the UPDATE statement has no ORDER BY clause, then all rows that would be updated in the absence of the LIMIT clause are assembled in an arbitrary order before applying the LIMIT and OFFSET clauses to determine which are actually updated. <p>The ORDER BY clause on an UPDATE statement is used only to determine which rows fall within the LIMIT. The order in which rows are modified is arbitrary and is not influenced by the ORDER BY clause. |
Changes to Doc/Extra/Core/lang_vacuum.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | < < > | < | > > > > | > > > > | < < > > > > > > > > > > > > > > > > > > | > | | | > | > | < < | > > | > | | | | > > > | | | > > | < > > | < < < < > > | | | > | > > > > > > > > > > > > > > > > | < > > > > > | | | | > | > > > > > | | < < | > > | < < < | > | | > > | > > | > > | | > > > > > > > > > | > | | > > > > > > > | > > > | > > | | > | > > > > | < < < < < < | | | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: VACUUM</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>VACUUM</h2><p><b><a href="syntaxdiagrams.html#vacuum-stmt">vacuum-stmt:</a></b> <button id='x1415' onclick='hideorshow("x1415","x1416")'>hide</button></p> <blockquote id='x1416'> <img alt="syntax diagram vacuum-stmt" src="images/syntax/vacuum-stmt.gif" /> </blockquote> <p> The VACUUM command rebuilds the entire database. There are several reasons an application might do this: <ul> <li> <p> Unless SQLite is running in "auto_vacuum=FULL" mode, when a large amount of data is deleted from the database file it leaves behind empty space, or "free" database pages. This means the database file might be larger than strictly necessary. Running VACUUM to rebuild the database reclaims this space and reduces the size of the database file. <li> <p> Frequent inserts, updates, and deletes can cause the database file to become fragmented - where data for a single table or index is scattered around the database file. Running VACUUM ensures that each table and index is largely stored contiguously within the database file. In some cases, VACUUM may also reduce the number of partially filled pages in the database, reducing the size of the database file further. <li> <p> Normally, the database <a href="pragma.html#pragma_page_size">page_size</a> and whether or not the database supports <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> must be configured before the database file is actually created. However, when not in <a href="wal.html">write-ahead log</a> mode, the <a href="pragma.html#pragma_page_size">page_size</a> and/or <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> properties of an existing database may be changed by using the <a href="pragma.html#pragma_page_size">page_size</a> and/or <a href="pragma.html#pragma_auto_vacuum">pragma auto_vacuum</a> pragmas and then immediately VACUUMing the database. When in <a href="wal.html">write-ahead log</a> mode, only the <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> support property can be changed using VACUUM. </ul> <p>VACUUM only works on the main database. It is not possible to VACUUM an attached database file. <p>The VACUUM command works by copying the contents of the database into a temporary database file and then overwriting the original with the contents of the temporary file. When overwriting the original, a rollback journal or <a href="wal.html">write-ahead log</a> WAL file is used just as it would be for any other database transaction. This means that when VACUUMing a database, as much as twice the size of the original database file is required in free disk space. <p>The VACUUM command may change the <a href="lang_createtable.html#rowid">ROWIDs</a> of entries in any tables that do not have an explicit <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a>. </p> <p>A VACUUM will fail if there is an open transaction, or if there are one or more active SQL statements when it is run. <p>As of SQLite version 3.1, an alternative to using the VACUUM command to reclaim space after data has been deleted is auto-vacuum mode, enabled using the <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> pragma. When <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> is enabled for a database free pages may be reclaimed after deleting data, causing the file to shrink, without rebuilding the entire database using VACUUM. However, using <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> can lead to extra database file fragmentation. And <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> does not compact partially filled pages of the database as VACUUM does. </p> |
Added Doc/Extra/Core/lang_with.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>SQLite Query Language: WITH clause</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>WITH clause</h2><p><b><a href="syntaxdiagrams.html#with-clause">with-clause:</a></b> <button id='x1121' onclick='hideorshow("x1121","x1122")'>hide</button></p> <blockquote id='x1122'> <img alt="syntax diagram with-clause" src="images/syntax/with-clause.gif" /> <p><b><a href="syntaxdiagrams.html#cte-table-name">cte-table-name:</a></b> <button id='x1123' onclick='hideorshow("x1123","x1124")'>show</button></p> <blockquote id='x1124' style='display:none;'> <img alt="syntax diagram cte-table-name" src="images/syntax/cte-table-name.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#select-stmt">select-stmt:</a></b> <button id='x1125' onclick='hideorshow("x1125","x1126")'>show</button></p> <blockquote id='x1126' style='display:none;'> <img alt="syntax diagram select-stmt" src="images/syntax/select-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#common-table-expression">common-table-expression:</a></b> <button id='x1127' onclick='hideorshow("x1127","x1128")'>show</button></p> <blockquote id='x1128' style='display:none;'> <img alt="syntax diagram common-table-expression" src="images/syntax/common-table-expression.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#compound-operator">compound-operator:</a></b> <button id='x1129' onclick='hideorshow("x1129","x1130")'>show</button></p> <blockquote id='x1130' style='display:none;'> <img alt="syntax diagram compound-operator" src="images/syntax/compound-operator.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#expr">expr:</a></b> <button id='x1131' onclick='hideorshow("x1131","x1132")'>show</button></p> <blockquote id='x1132' style='display:none;'> <img alt="syntax diagram expr" src="images/syntax/expr.gif" /> <p><b><a href="syntaxdiagrams.html#literal-value">literal-value:</a></b> <button id='x1133' onclick='hideorshow("x1133","x1134")'>show</button></p> <blockquote id='x1134' style='display:none;'> <img alt="syntax diagram literal-value" src="images/syntax/literal-value.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#raise-function">raise-function:</a></b> <button id='x1135' onclick='hideorshow("x1135","x1136")'>show</button></p> <blockquote id='x1136' style='display:none;'> <img alt="syntax diagram raise-function" src="images/syntax/raise-function.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#type-name">type-name:</a></b> <button id='x1137' onclick='hideorshow("x1137","x1138")'>show</button></p> <blockquote id='x1138' style='display:none;'> <img alt="syntax diagram type-name" src="images/syntax/type-name.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1139' onclick='hideorshow("x1139","x1140")'>show</button></p> <blockquote id='x1140' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#join-clause">join-clause:</a></b> <button id='x1141' onclick='hideorshow("x1141","x1142")'>show</button></p> <blockquote id='x1142' style='display:none;'> <img alt="syntax diagram join-clause" src="images/syntax/join-clause.gif" /> <p><b><a href="syntaxdiagrams.html#join-constraint">join-constraint:</a></b> <button id='x1143' onclick='hideorshow("x1143","x1144")'>show</button></p> <blockquote id='x1144' style='display:none;'> <img alt="syntax diagram join-constraint" src="images/syntax/join-constraint.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#join-operator">join-operator:</a></b> <button id='x1145' onclick='hideorshow("x1145","x1146")'>show</button></p> <blockquote id='x1146' style='display:none;'> <img alt="syntax diagram join-operator" src="images/syntax/join-operator.gif" /> </blockquote> </blockquote> <p><b><a href="syntaxdiagrams.html#ordering-term">ordering-term:</a></b> <button id='x1147' onclick='hideorshow("x1147","x1148")'>show</button></p> <blockquote id='x1148' style='display:none;'> <img alt="syntax diagram ordering-term" src="images/syntax/ordering-term.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#result-column">result-column:</a></b> <button id='x1149' onclick='hideorshow("x1149","x1150")'>show</button></p> <blockquote id='x1150' style='display:none;'> <img alt="syntax diagram result-column" src="images/syntax/result-column.gif" /> </blockquote> <p><b><a href="syntaxdiagrams.html#table-or-subquery">table-or-subquery:</a></b> <button id='x1151' onclick='hideorshow("x1151","x1152")'>show</button></p> <blockquote id='x1152' style='display:none;'> <img alt="syntax diagram table-or-subquery" src="images/syntax/table-or-subquery.gif" /> </blockquote> </blockquote> </blockquote> <p>Common Table Expressions or CTEs act like temporary <a href="lang_createview.html">views</a> that exist only for the duration of a single SQL statement. There are two kinds of common table expressions: "ordinary" and "recursive". Ordinary common table expressions are helpful for making queries easier to understand by factoring subqueries out of the main SQL statement. Recursive common table expression provide the ability to do hierarchical or recursive queries of trees and graphs, a capability that is not otherwise available in the SQL language. All common table expressions (ordinary and recursive) are created by prepending a WITH clause in front of a <a href="lang_select.html">SELECT</a>, <a href="lang_insert.html">INSERT</a>, <a href="lang_delete.html">DELETE</a>, or <a href="lang_update.html">UPDATE</a> statement. A single WITH clause can specify one or more common table expressions. <a name="ordinarycte"></a> <h3>Ordinary Common Table Expressions</h3> <p>An ordinary common table expression works as if it were a <a href="lang_createview.html">view</a> that exists for the duration of a single statement. Ordinary common table expressions are useful for factoring out subqueries and making the overall SQL statement easier to read and understand. <a name="recursivecte"></a> <h3>Recursive Common Table Expressions</h3> <p>A recursive common table expression can be used to write a query that walks a tree or graph. A recursive common table expression has the same basic syntax as an ordinary common table expression, but with the following additional features: <ol> <li> The "<a href="syntaxdiagrams.html#select-stmt">select-stmt</a>" must be a <a href="lang_select.html#compound">compound select</a> where the right-most <a href="syntaxdiagrams.html#compound-operator">compound-operator</a> is either UNION or UNION ALL. <li> The table named on the left-hand side of the AS keyword must appear exactly once in the FROM clause of the right-most SELECT statement of the compound select, and nowhere else. </ol> <p>To put it another way, a recursive common table expression must look like the following: <p><b><a href="syntaxdiagrams.html#recursive-cte">recursive-cte:</a></b> <button id='x1153' onclick='hideorshow("x1153","x1154")'>hide</button></p> <blockquote id='x1154'> <img alt="syntax diagram recursive-cte" src="images/syntax/recursive-cte.gif" /> <p><b><a href="syntaxdiagrams.html#cte-table-name">cte-table-name:</a></b> <button id='x1155' onclick='hideorshow("x1155","x1156")'>show</button></p> <blockquote id='x1156' style='display:none;'> <img alt="syntax diagram cte-table-name" src="images/syntax/cte-table-name.gif" /> </blockquote> </blockquote> <p>We refer to the table named by the cte-table-name in a recursive common table expression as the "recursive table". In the recursive-cte bubble diagram above, the recursive table must appear exactly once in the FROM clause of the recursive-select and must not appear anywhere else in either the initial-select or the recursive-select, including subqueries. The initial-select may be a <a href="lang_select.html#compound">compound select</a>, but it may not include an ORDER BY, LIMIT, or OFFSET. The recursive-select must be a simple select, not a compound. The recursive-select is allowed to include an ORDER BY, LIMIT, and/or OFFSET. <p>The basic algorithm for computing the content of the recursive table is as follows: <ol> <li> Run the initial-select and add the results to a queue. <li> While the queue is not empty: <ol type="a"> <li> Extract a single row from the queue. <li> Insert that single row into the recursive table <li> Pretend that the single row just extracted is the only row in the recursive table and run the recursive-select, adding all results to the queue. </ol> </ol> <p>The basic procedure above may modified by the following additional rules: <ul> <li><p> If a UNION operator connects the initial-select with the recursive-select, then only add rows to the queue if no identical row has been previously added to the queue. Repeated rows are discarded before being added to the queue even if the repeated rows have already been extracted from the queue by the recursion step. If the operator is UNION ALL, then all rows generated by both the initial-select and the recursive-select are always added to the queue even if they are repeats. When determining if a row is repeated, NULL values compare equal to one another and not equal to any other value. <li><p> The LIMIT clause, if present, determines the maximum number of rows that will ever be added to the recursive table in step 2b. Once the limit is reached, the recursion stops. A limit of zero means that no rows are ever added to the recursive table, and a negative limit means an unlimited number of rows may be added to the recursive table. <li><p> The OFFSET clause, if it is present and has a positive value N, prevents the first N rows from being added to the recursive table. The first N rows are still processed by the recursive-select; they just are not added to the recursive table. Rows are not counted toward fulfilling the LIMIT until all OFFSET rows have been skipped. <li><p> If an ORDER BY clause is present, it determines the order in which rows are extracted from the queue in step 2a. If there is no ORDER BY clause, then the order in which rows are extracted is undefined. (In the current implementation, the queue becomes a FIFO if the ORDER BY clause is omitted, but applications should not depend on that fact since it might change.) </ul> <a name="rcex1"></a> <h4>Recursive Query Examples</h4> <p>The following query returns all integers between 1 and 1000000: <blockquote><pre> WITH RECURSIVE cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x<1000000) SELECT x FROM cnt; </pre></blockquote> <p>Consider how this query works. The initial-select runs first and returns a single row with a single column "1". This one row is added to the queue. In step 2a, that one row is extracted from the queue and added to "cnt". Then the recursive-select is run in accordance with step 2c generating a single new row with value "2" to add to the queue. The queue still has one row, so step 2 repeats. The "2" row is extracted and added to the recursive table by steps 2a and 2b. Then the row containing 2 is used as if it were the complete content of the recursive table and the recursive-select is run again, resulting in a row with value "3" being added to the queue. This repeats 999999 times until finally at step 2a the only value on the queue is a row containing 1000000. That row is extracted and added to the recursive table. But this time, the WHERE clause causes the recursive-select to return no rows, so the queue remains empty and the recursion stops. <p><b>Optimization note:</b> In the discussion above, statements like "insert the row into the recursive table" should be understood conceptually, not literally. It sounds as if SQLite is accumulating a huge table containing one million rows, then going back and scanning that table from top to bottom to generate the result. What really happens is that the query optimizer sees that values in the "cnt" recursive table are only used once. So as each row is added to the recursive table, that row is immediately returned as a result of the main SELECT statement and then discarded. SQLite does <em>not</em> accumulate a temporary table containing a million rows. Very little memory is needed to run the above example. However, if the example had used UNION instead of UNION ALL, then SQLite would have had to keep around all previously generated content in order to check for duplicates. For this reason, programmers should strive to use UNION ALL instead of UNION when feasible. <p>Here is a variation on the previous example: <blockquote><pre> WITH RECURSIVE cnt(x) AS ( SELECT 1 UNION ALL SELECT x+1 FROM cnt LIMIT 1000000 ) SELECT x FROM cnt; </pre></blockquote> <p>There are two differences in this variation. The initial-select is "SELECT 1" instead of "VALUES(1)". But those are just different syntaxes for saying exactly the same thing. The other change is that the recursion is stopped by a LIMIT rather than a WHERE clause. The use of LIMIT means that when the one-millionth row is added to the "cnt" table (and returned by the main SELECT, thanks to the query optimizer) then the recursion stops immediately regardless of how many rows might be left in the queue. On more complex queries, it can sometimes be difficult to ensure that the WHERE clause will eventually cause the queue to drain and the recursion to terminate. But the LIMIT clause will always stop the recursion. So it is good practice to always include a LIMIT clause as a safety if an upper bound on the size of the recursion is known. <a name="rcex2"></a> <h4>Hierarchical Query Examples</h4> <p>Consider a table that describes the members of an organization as well as the chain-of-command within that organization: <blockquote><pre> CREATE TABLE org( name TEXT PRIMARY KEY, boss TEXT REFERENCES org, height INT, -- other content omitted ); </pre></blockquote> <p>Every member in the organization has a name, and most members have a single boss. (The head of the whole organization has a NULL "boss" field.) The rows of the "org" table form a tree. <p>Here is a query that computes the average height over everyone in Alice's organization, including Alice: <blockquote><pre> WITH RECURSIVE works_for_alice(n) AS ( VALUES('Alice') UNION SELECT name FROM org, works_for_alice WHERE org.boss=works_for_alice.n ) SELECT avg(height) FROM org WHERE org.name IN works_for_alice; </pre></blockquote> <p>The next example uses two common table expressions in a single WITH clause. The following table records a family tree: <blockquote><pre> CREATE TABLE family( name TEXT PRIMARY KEY, mom TEXT REFERENCES family, dad TEXT REFERENCES family, born DATETIME, died DATETIME, -- NULL if still alive -- other content ); </pre></blockquote> <p>The "family" table is similar to the earlier "org" table except that now there are two parents to each member. We want to know all living ancestors of Alice, from oldest to youngest. An ordinary common table expression, "parent_of", is defined first. That ordinary CTE is a view that can be used to find all parents of any individual. That ordinary CTE is then used in the "ancestor_of_alice" recursive CTE. The recursive CTE is then used in the final query: <blockquote><pre> WITH RECURSIVE parent_of(name, parent) AS (SELECT name, mom FROM family UNION SELECT name, dad FROM family), ancestor_of_alice(name) AS (SELECT parent FROM parent_of WHERE name='Alice' UNION ALL SELECT parent FROM parent_of JOIN ancestor_of_alice USING(name)) SELECT family.name FROM ancestor_of_alice, family WHERE ancestor_of_alice.name=family.name AND died IS NULL ORDER BY born; </pre></blockquote> <a name="rcex2"></a> <h4>Queries Against A Graph</h4> <p>A version control system (VCS) will typically store the evolving versions of a project as a directed acyclic graph (DAG). Call each version of the project a "checkin". A single checkin can have zero or more parents. Most checkins (except the first) have a single parent, but in the case of a merge, a checkin might have two or three or more parents. A schema to keep track of checkins and the order in which they occur might look something like this: <blockquote><pre> CREATE TABLE checkin( id INTEGER PRIMARY KEY, mtime INTEGER -- timestamp when this checkin occurred ); CREATE TABLE derivedfrom( xfrom INTEGER NOT NULL REFERENCES checkin, -- parent checkin xto INTEGER NOT NULL REFERENCES checkin, -- derived checkin PRIMARY KEY(xfrom,xto) ); CREATE INDEX derivedfrom_back ON derivedfrom(xto,xfrom); </pre></blockquote> <p>This graph is acyclic. And we assume that the mtime of every child checkin is no less than the mtime of all its parents. But unlike the earlier examples, this graph might have multiple paths of differing lengths between any two checkins. <p>We want to know the twenty most recent ancestors in time (out of the thousands and thousands of ancestors in the whole DAG) for checkin "@BASELINE". (A query similar to this is used by the <a href="http://www.fossil-scm.org/">Fossil</a> VCS to show the N most recent ancestors of a check. For example: <a href="http://www.sqlite.org/src/timeline?p=trunk&n=30">http://www.sqlite.org/src/timeline?p=trunk&n=30</a>.) <blockquote><pre> WITH RECURSIVE ancestor(id,mtime) AS ( SELECT id, mtime FROM checkin WHERE id=@BASELINE UNION SELECT derivedfrom.xfrom, checkin.mtime FROM ancestor, derivedfrom, checkin WHERE ancestor.id=derivedfrom.xto AND checkin.id=derivedfrom.xfrom ORDER BY checkin.mtime DESC LIMIT 20 ) SELECT * FROM checkin JOIN ancestor USING(id); </pre></blockquote> <p> The "ORDER BY checkin.mtime DESC" term in the recursive-select makes the query run much faster by preventing it from following branches that merge checkins from long ago. The ORDER BY forces the recursive-select to focus on the most recent checkins, the ones we want. Without the ORDER BY on the recursive-select, one would be forced to compute the complete set of thousands of ancestors, sort them all by mtime, then take the top twenty. The ORDER BY essentially sets up a priority queue that forces the recursive query to look at the most recent ancestors first, allowing the use of a LIMIT clause to restrict the scope of the query to just the checkins of interest. <a name="withorderby"></a> <h4>Controlling Depth-First Versus Breadth-First Search Of a Tree Using ORDER BY</h4> <p>An ORDER BY clause on the recursive-select can be used to control whether the search of a tree is depth-first or breadth-first. To illustrate, we will use a variation on the "org" table from an example above, without the "height" column, and with some real data inserted: <blockquote><pre> CREATE TABLE org( name TEXT PRIMARY KEY, boss TEXT REFERENCES org ) WITHOUT ROWID; INSERT INTO org VALUES('Alice',NULL); INSERT INTO org VALUES('Bob','Alice'); INSERT INTO org VALUES('Cindy','Alice'); INSERT INTO org VALUES('Dave','Bob'); INSERT INTO org VALUES('Emma','Bob'); INSERT INTO org VALUES('Fred','Cindy'); INSERT INTO org VALUES('Gail','Cindy'); </pre></blockquote> <p>Here is a query to show the tree structure in a breadth-first pattern: <blockquote><pre> WITH RECURSIVE under_alice(name,level) AS ( VALUES('Alice',0) UNION ALL SELECT org.name, under_alice.level+1 FROM org JOIN under_alice ON org.name=under_alice.boss ORDER BY 2 ) SELECT substr('..........',1,level*3) || name FROM under_alice; </pre></blockquote> <p>The "ORDER BY 2" (which means the same as "ORDER BY under_alice.level+1") causes higher levels in the organization chart (with smaller "level" values) to be processed first, resulting in a breadth-first search. The output is: <blockquote><pre> Alice ...Bob ...Cindy ......Dave ......Emma ......Fred ......Gail </pre></blockquote> <p>But if we change the ORDER BY clause to add the "DESC" modifier, that will cause lower levels in the organization (with larger "level" values) to be processed first by the recursive-select, resulting in a depth-first search: <blockquote><pre> WITH RECURSIVE under_alice(name,level) AS ( VALUES('Alice',0) UNION ALL SELECT org.name, under_alice.level+1 FROM org JOIN under_alice ON org.name=under_alice.boss ORDER BY 2 <b>DESC</b> ) SELECT substr('..........',1,level*3) || name FROM under_alice; </pre></blockquote> <p>The output of this revised query is: <blockquote><pre> Alice ...Bob ......Dave ......Emma ...Cindy ......Fred ......Gail </pre></blockquote> <p>When the ORDER BY clause is omitted from the recursive-select, the queue behaves as a FIFO, which results in a breadth-first search. <a name="mandelbrot"></a> <h4>Outlandish Recursive Query Examples</h4> <p>The following query computes an approximation of the Mandelbrot Set and outputs the result as ASCII-art: <blockquote><pre> WITH RECURSIVE xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2), yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0), m(iter, cx, cy, x, y) AS ( SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis UNION ALL SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m WHERE (x*x + y*y) < 4.0 AND iter<28 ), m2(iter, cx, cy) AS ( SELECT max(iter), cx, cy FROM m GROUP BY cx, cy ), a(t) AS ( SELECT group_concat( substr(' .+*#', 1+min(iter/7,4), 1), '') FROM m2 GROUP BY cy ) SELECT group_concat(rtrim(t),x'0a') FROM a; </pre></blockquote> <p>In this query, the "xaxis" and "yaxis" CTEs define the grid of points for which the Mandelbrot Set will be approximated. Each row in the "m(iter,cx,cy,x,y)" CTE means that after "iter" iterations, the Mandelbrot iteration starting at cx,cy has reached point x,y. The number of iterations in this example is limited to 28 (which severely limits the resolution of the computation, but is sufficient for low-resolution ASCII-art output). The "m2(iter,cx,cy)" CTE holds the maximum number of iterations reached when starting at point cx,cy. Finally, each row in the "a(t)" CTE holds a string which is a single line of the output ASCII-art. The SELECT statement at the end just queries the "a" CTE to retrieve all lines of ASCII-art, one by one. <p>Running the query above into an SQLite <a href="sqlite.html">command-line shell</a> results in the following output: <blockquote><pre> ....# ..#*.. ..+####+. .......+####.... + ..##+*##########+.++++ .+.##################+. .............+###################+.+ ..++..#.....*#####################+. ...+#######++#######################. ....+*################################. #############################################... ....+*################################. ...+#######++#######################. ..++..#.....*#####################+. .............+###################+.+ .+.##################+. ..##+*##########+.++++ .......+####.... + ..+####+. ..#*.. ....# +. </pre></blockquote> <a name="sudoku"></a> <p>This next query solves a Sudoku puzzle. The state of the puzzle is defined by an 81-character string formed by reading entries from the puzzle box row by row from left to right and then from top to bottom. Blank squares in the puzzle are denoted by a "." character. Thus the input string: <blockquote> 53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79 </blockquote> <p>Corresponds to a puzzle like this: <blockquote> <table border="1" cellpadding="5"> <tr><td>5<td>3<td> <td> <td>7<td> <td> <td> <td> <tr><td>6<td> <td> <td>1<td>9<td>5<td> <td> <td> <tr><td> <td>9<td>8<td> <td> <td> <td> <td>6<td> <tr><td>8<td> <td> <td> <td>6<td> <td> <td> <td>3 <tr><td>4<td> <td> <td>8<td> <td>3<td> <td> <td>1 <tr><td>7<td> <td> <td> <td>2<td> <td> <td> <td>6 <tr><td> <td>6<td> <td> <td> <td> <td>2<td>8<td> <tr><td> <td> <td> <td>4<td>1<td>9<td> <td> <td>5 <tr><td> <td> <td> <td> <td>8<td> <td> <td>7<td>9 </table> </blockquote> <p>This is the query that solves the puzzle: <blockquote><pre> WITH RECURSIVE input(sud) AS ( VALUES('53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79') ), digits(z, lp) AS ( VALUES('1', 1) UNION ALL SELECT CAST(lp+1 AS TEXT), lp+1 FROM digits WHERE lp<9 ), x(s, ind) AS ( SELECT sud, instr(sud, '.') FROM input UNION ALL SELECT substr(s, 1, ind-1) || z || substr(s, ind+1), instr( substr(s, 1, ind-1) || z || substr(s, ind+1), '.' ) FROM x, digits AS z WHERE ind>0 AND NOT EXISTS ( SELECT 1 FROM digits AS lp WHERE z.z = substr(s, ((ind-1)/9)*9 + lp, 1) OR z.z = substr(s, ((ind-1)%9) + (lp-1)*9 + 1, 1) OR z.z = substr(s, (((ind-1)/3) % 3) * 3 + ((ind-1)/27) * 27 + lp + ((lp-1) / 3) * 6, 1) ) ) SELECT s FROM x WHERE ind=0; </pre></blockquote> <p>The "input" CTE defines the input puzzle. The "digits" CTE defines a table that holds all digits between 1 and 9. The work of solving the puzzle is undertaken by the "x" CTE. An entry in x(s,ind) means that the 81-character string "s" is a valid sudoku puzzle (it has no conflicts) and that the first unknown character is at position "ind", or ind==0 if all character positions are filled in. The goal, then, is to compute entries for "x" with an "ind" of 0. <p>The solver works by adding new entries to the "x" recursive table. Given prior entries, the recursive-select tries to fill in a single new position with all values between 1 and 9 that actually work in that position. The complicated "NOT EXISTS" subquery is the magic that figures out whether or not each candidate "s" string is a valid sudoku puzzle or not. <p>The final answer is found by looking for a string with ind==0. If the original sudoku problem did not have a unique solution, then the query will return all possible solutions. If the original problem was unsolvable, then no rows will be returned. In this case, the unique answer is: <blockquote> 534678912672195348198342567859761423426853791713924856961537284287419635345286179 </blockquote> <p>The solution was computed in less than 300 milliseconds on a modern workstation. <h3>Limitations And Caveats</h3> <ul> <li><p> The WITH clause cannot be used within a <a href="lang_createtrigger.html">CREATE TRIGGER</a>. <li><p> The WITH clause must appear at the beginning of a top-level <a href="lang_select.html">SELECT</a> statement or at the beginning of a subquery. The WITH clause cannot be prepended to the second or subsequent SELECT statement of a <a href="lang_select.html#compound">compound select</a>. <li><p> The SQL:1999 spec requires that the RECURSIVE keyword follow WITH in any WITH clause that includes a recursive common table expression. However, for compatibility with SqlServer and Oracle, SQLite does not enforce this rule. </ul> |
Changes to Doc/Extra/Core/pragma.html.
|
| | | | | | < | > > | > | > > | > > > | > > > > > | | > | > > > > > > | > > > > > > > | > > > > | < > > > > > > > > > > > > > | > > > > | > | < | | > | > > > > > | | | < | < < | < < | > > > | > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | > | | | | | > | | | | | | | | | | | > | > > > | > > | | | > > > > | | > > | > > > > > > > > > > > | > > | | < < < < > > > > > | | > | | | | | | | | | | | | | > > > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | > | > > > > > > | > > | > > > > | < > > > > > > > > > | > > | < > | < | > > > > > > > > > > > | > > > > > > > > > > > > > > | > | > > > > > > > | > > | | | > | > | > > | | | > > | > | > > > > > > > > > > > > > > > > > | | < < < < < < < < < < > | > | | > | | > > | > > > > > > > > | < | | | | < > > > > > > > > > | > > > > > > > > > | > > > | | | < | | > | > > > > > > > > > > > > > > > > > > > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | | > | < | < < > > > > > > | | > > > > > > > | > > > > > > > > | > > > > > > | > > > > | | > > > > > > > > > > > > > > > > > | | < | | > | > > > > > > > > | | > > > > > > > | > > > > > > > > > > > > > > > > > | < | | < | | | | | | > | | | | | > > > > > > > > | > | < | | < | < | < | < | < | > | | | | > > > > > > > > > > > > > > > | | | | < | > | | | | | > > > > > > | | | > | > > > > > | < | > | < > | > | > | < > > > | | < < > > > > > > > > | < < | > | < | | < | | | > | | | > | > > > > > > > > | > > | | | < | | < < > | > > > | > | > > | > > > | > | < | | | > > | > | < > > | < < > | > > > > > | > > > > > > | < | | < < | | | | < < < | > > > > > > > > > > > > > > | < | | > | > | > | | < < | | | | | | > > > > > > > > > | > > > > > > | > > > > | > > > > > > > > | > | | | | | > > > > > > | > > > > > > > > > | > > > > > > | < | > > | | < < < > > > > > > | > > | > > > | < < < | | > > > | > | | > > > > > > > > | | < > > | < > > | < | | | > > > > > > | > > > > | > > | > > > | > | | | | > > > | > > > | | > > > > > > | < < > | > > > | > > > > > | > > | | < < < > | | > > > > | | > > > > | | > > > > > | | > | < < < < < > > | > > > | > | > > | > > > > > > > > | | > > > > > > | | > > > > > | < > | | | | | | | | | | | | | | | | | | > > > > > > > > > | | < > > > > > > > > > > > > > > > > > > > | > > > | > | > > > > | | > > > | | > | > > | | | > | < > > > > > > | < > | < > > > > > > > > | | > > | | | | | > | > > > > | > > > > > | | < < > > > | < | | < | < < < < > > > > > > > > > > > > > | > > | > > > > > > | | > > > > > | > > > > > > > > > | > > > > > > > > > > > > > | | > > > > > | < < < > > > > | > | < < < < < < < > > | > > > | > > > > > > > > | | | | > | > > > | | < | | > | > > > > | < < | | | > > > > > > > > > > | > | | | | | | | | | | | | | > > > > > > > > > > > | | | | | > > > > > > > > > > | > | > | < | | < | > | | | > | < | | < < < < | | > | > > > > > | > > > > > > | > > > > > | | > > | > > > > > > > > > > > > > > > > > > > > > > > > > | | | < < | > > > > > | > | < < > > | < | > | | > > > > > > | > > > > | | > > > > | | | > > > > > | | < | < | | | > > > > > > | | > > > > | < | | > | > > > > > > | | > > > > | > | > | | > > > > > > > > > | > > > > | > | < | | | > | < < > > | | | | > > > > | > > | > | > > > > > > > | > > | > | | < < < | < < | > > > > | | > | > > | | > > > > > > | > > > > > > > > > > > > > > > > | > | > > > > | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Pragma statements supported by SQLite</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align="center">PRAGMA Statements</h1> <p>The PRAGMA statement is an SQL extension specific to SQLite and used to modify the operation of the SQLite library or to query the SQLite library for internal (non-table) data. The PRAGMA statement is issued using the same interface as other SQLite commands (e.g. <a href="lang_select.html">SELECT</a>, <a href="lang_insert.html">INSERT</a>) but is different in the following important respects: </p> <ul> <li>Specific pragma statements may be removed and others added in future releases of SQLite. There is no guarantee of backwards compatibility. <li>No error messages are generated if an unknown pragma is issued. Unknown pragmas are simply ignored. This means if there is a typo in a pragma statement the library does not inform the user of the fact. <li>Some pragmas take effect during the SQL compilation stage, not the execution stage. This means if using the C-language <a href="c3ref/prepare.html">sqlite3_prepare()</a>, <a href="c3ref/step.html">sqlite3_step()</a>, <a href="c3ref/finalize.html">sqlite3_finalize()</a> API (or similar in a wrapper interface), the pragma may run during the <a href="c3ref/prepare.html">sqlite3_prepare()</a> call, not during the <a href="c3ref/step.html">sqlite3_step()</a> call as normal SQL statements do. Or the pragma might run during sqlite3_step() just like normal SQL statements. Whether or not the pragma runs during sqlite3_prepare() or sqlite3_step() depends on the pragma and on the specific release of SQLite. <li>The pragma command is specific to SQLite and is very unlikely to be compatible with any other SQL database engine. </ul> <p>The C-language API for SQLite provides the <a href="c3ref/c_fcntl_busyhandler.html#sqlitefcntlpragma">SQLITE_FCNTL_PRAGMA</a> <a href="c3ref/file_control.html">file control</a> which gives <a href="vfs.html">VFS</a> implementations the opportunity to add new PRAGMA statements or to override the meaning of built-in PRAGMA statements.</p> <hr /><a name="syntax"></a> <h2>PRAGMA command syntax</h2> <p><b><a href="syntaxdiagrams.html#pragma-stmt">pragma-stmt:</a></b> <button id='x1451' onclick='hideorshow("x1451","x1452")'>hide</button></p> <blockquote id='x1452'> <img alt="syntax diagram pragma-stmt" src="images/syntax/pragma-stmt.gif" /> <p><b><a href="syntaxdiagrams.html#pragma-value">pragma-value:</a></b> <button id='x1453' onclick='hideorshow("x1453","x1454")'>hide</button></p> <blockquote id='x1454'> <img alt="syntax diagram pragma-value" src="images/syntax/pragma-value.gif" /> <p><b><a href="syntaxdiagrams.html#signed-number">signed-number:</a></b> <button id='x1455' onclick='hideorshow("x1455","x1456")'>show</button></p> <blockquote id='x1456' style='display:none;'> <img alt="syntax diagram signed-number" src="images/syntax/signed-number.gif" /> </blockquote> </blockquote> </blockquote> <p> A pragma can take either zero or one argument. The argument is may be either in parentheses or it may be separated from the pragma name by an equal sign. The two syntaxes yield identical results. In many pragmas, the argument is a boolean. The boolean can be one of: </p> <center> <b>1 yes true on<br>0 no false off</b> </center> <p>Keyword arguments can optionally appear in quotes. (Example: <tt>'yes' [FALSE]</tt>.) Some pragmas takes a string literal as their argument. When pragma takes a keyword argument, it will usually also take a numeric equivalent as well. For example, "0" and "no" mean the same thing, as does "1" and "yes". When querying the value of a setting, many pragmas return the number rather than the keyword.</p> <p>A pragma may have an optional database name before the pragma name. The database name is the name of an <a href="lang_attach.html">ATTACH</a>-ed database or it can be "main" or "temp" for the main and the TEMP databases. If the optional database name is omitted, "main" is assumed. In some pragmas, the database name is meaningless and is simply ignored.</p> <hr /><a name="toc"></a> <h2>List Of PRAGMAs</h2> <table border=0 width="100%" cellpadding=10> <tr><td valign="top" align="left"><ul> <li><a href="#pragma_application_id">application_id</a> <li><a href="#pragma_auto_vacuum">auto_vacuum</a> <li><a href="#pragma_automatic_index">automatic_index</a> <li><a href="#pragma_busy_timeout">busy_timeout</a> <li><a href="#pragma_cache_size">cache_size</a> <li><a href="#pragma_cache_spill">cache_spill</a> <li><a href="#pragma_case_sensitive_like">case_sensitive_like</a> <li><a href="#pragma_checkpoint_fullfsync">checkpoint_fullfsync</a> <li><a href="#pragma_collation_list">collation_list</a> <li><a href="#pragma_compile_options">compile_options</a> <li><a href="#pragma_count_changes"><s>count_changes</s></a>¹ <li><a href="#pragma_data_store_directory"><s>data_store_directory</s></a>¹ <li><a href="#pragma_database_list">database_list</a> <li><a href="#pragma_default_cache_size"><s>default_cache_size</s></a>¹ <li><a href="#pragma_defer_foreign_keys">defer_foreign_keys</a> <li><a href="#pragma_empty_result_callbacks"><s>empty_result_callbacks</s></a>¹ <li><a href="#pragma_encoding">encoding</a> <li><a href="#pragma_foreign_key_check">foreign_key_check</a> <li><a href="#pragma_foreign_key_list">foreign_key_list</a> <li><a href="#pragma_foreign_keys">foreign_keys</a> </ul></td><td valign="top" align="left"><ul> <li><a href="#pragma_freelist_count">freelist_count</a> <li><a href="#pragma_full_column_names"><s>full_column_names</s></a>¹ <li><a href="#pragma_fullfsync">fullfsync</a> <li><a href="#pragma_ignore_check_constraints">ignore_check_constraints</a> <li><a href="#pragma_incremental_vacuum">incremental_vacuum</a> <li><a href="#pragma_index_info">index_info</a> <li><a href="#pragma_index_list">index_list</a> <li><a href="#pragma_integrity_check">integrity_check</a> <li><a href="#pragma_journal_mode">journal_mode</a> <li><a href="#pragma_journal_size_limit">journal_size_limit</a> <li><a href="#pragma_legacy_file_format">legacy_file_format</a> <li><a href="#pragma_locking_mode">locking_mode</a> <li><a href="#pragma_max_page_count">max_page_count</a> <li><a href="#pragma_mmap_size">mmap_size</a> <li><a href="#pragma_page_count">page_count</a> <li><a href="#pragma_page_size">page_size</a> <li><a href="#pragma_parser_trace"><i>parser_trace</i></a>² <li><a href="#pragma_query_only">query_only</a> <li><a href="#pragma_quick_check">quick_check</a> <li><a href="#pragma_read_uncommitted">read_uncommitted</a> </ul></td><td valign="top" align="left"><ul> <li><a href="#pragma_recursive_triggers">recursive_triggers</a> <li><a href="#pragma_reverse_unordered_selects">reverse_unordered_selects</a> <li><a href="#pragma_schema_version">schema_version</a> <li><a href="#pragma_secure_delete">secure_delete</a> <li><a href="#pragma_short_column_names"><s>short_column_names</s></a>¹ <li><a href="#pragma_shrink_memory">shrink_memory</a> <li><a href="#pragma_soft_heap_limit">soft_heap_limit</a> <li><a href="#pragma_stats">stats</a> <li><a href="#pragma_synchronous">synchronous</a> <li><a href="#pragma_table_info">table_info</a> <li><a href="#pragma_temp_store">temp_store</a> <li><a href="#pragma_temp_store_directory"><s>temp_store_directory</s></a>¹ <li><a href="#pragma_schema_version">user_version</a> <li><a href="#pragma_vdbe_addoptrace"><i>vdbe_addoptrace</i></a>² <li><a href="#pragma_vdbe_debug"><i>vdbe_debug</i></a>² <li><a href="#pragma_vdbe_listing"><i>vdbe_listing</i></a>² <li><a href="#pragma_vdbe_trace"><i>vdbe_trace</i></a>² <li><a href="#pragma_wal_autocheckpoint">wal_autocheckpoint</a> <li><a href="#pragma_wal_checkpoint">wal_checkpoint</a> <li><a href="#pragma_writable_schema">writable_schema</a> </ul></td></tr></table> <p>Notes: <ol> <li>Pragmas whose names are marked through in the list above are deprecated that are maintained for historical compatibility only. Do not use the deprecated pragmas in new applications. Remove deprecated pragmas from existing applications at your earliest opportunity.</blockquote> <li>These pragmas are used for debugging SQLite itself and are only available when SQLite is compiled using <a href="compile.html#debug">SQLITE_DEBUG</a>.</ol></p> <a name="pragma_application_id"></a> <hr> <p><b>PRAGMA application_id; <br>PRAGMA application_id = </b><i>integer </i><b>;</b> <p> The application_id PRAGMA is used to query or set the 32-bit unsigned big-endian "Application ID" integer located at offset 68 into the <a href="fileformat2.html#database_header">database header</a>. Applications that use SQLite as their <a href="whentouse.html#appfileformat">application file-format</a> should set the Application ID integer to a unique integer so that utilities such as <a href="http://www.darwinsys.com/file/">file(1)</a> can determine the specific file type rather than just reporting "SQLite3 Database". A list of assigned application IDs can be seen by consulting the <a href="http://www.sqlite.org/src/artifact?ci=trunk&filename=magic.txt">magic.txt</a> file in the SQLite source repository. <a name="pragma_auto_vacuum"></a> <hr> <p><b>PRAGMA auto_vacuum;<br> PRAGMA auto_vacuum = </b> <i>0 | NONE | 1 | FULL | 2 | INCREMENTAL</i><b>;</b></p> <p>Query or set the auto-vacuum status in the database.</p> <p>The default setting for auto-vacuum is 0 or "none", unless the <a href="compile.html#default_autovacuum">SQLITE_DEFAULT_AUTOVACUUM</a> compile-time option is used. The "none" setting means that auto-vacuum is disabled. When auto-vacuum is disabled and data is deleted data from a database, the database file remains the same size. Unused database file pages are added to a "<a href="fileformat2.html#freelist">freelist</a>" and reused for subsequent inserts. So no database file space is lost. However, the database file does not shrink. In this mode the <a href="lang_vacuum.html">VACUUM</a> command can be used to rebuild the entire database file and thus reclaim unused disk space.</p> <p>When the auto-vacuum mode is 1 or "full", the freelist pages are moved to the end of the database file and the database file is truncated to remove the freelist pages at every transaction commit. Note, however, that auto-vacuum only truncates the freelist pages from the file. Auto-vacuum does not defragment the database nor repack individual database pages the way that the <a href="lang_vacuum.html">VACUUM</a> command does. In fact, because it moves pages around within the file, auto-vacuum can actually make fragmentation worse.</p> <p>Auto-vacuuming is only possible if the database stores some additional information that allows each database page to be traced backwards to its referrer. Therefore, auto-vacuuming must be turned on before any tables are created. It is not possible to enable or disable auto-vacuum after a table has been created.</p> <p>When the value of auto-vacuum is 2 or "incremental" then the additional information needed to do auto-vacuuming is stored in the database file but auto-vacuuming does not occur automatically at each commit as it does with auto_vacuum=full. In incremental mode, the separate <a href="pragma.html#pragma_incremental_vacuum">incremental_vacuum</a> pragma must be invoked to cause the auto-vacuum to occur.</p> <p>The database connection can be changed between full and incremental autovacuum mode at any time. However, changing from "none" to "full" or "incremental" can only occur when the database is new (no tables have yet been created) or by running the <a href="lang_vacuum.html">VACUUM</a> command. To change auto-vacuum modes, first use the auto_vacuum pragma to set the new desired mode, then invoke the <a href="lang_vacuum.html">VACUUM</a> command to reorganize the entire database file. To change from "full" or "incremental" back to "none" always requires running <a href="lang_vacuum.html">VACUUM</a> even on an empty database. </p> <p>When the auto_vacuum pragma is invoked with no arguments, it returns the current auto_vacuum mode.</p> <a name="pragma_automatic_index"></a> <hr> <p><b>PRAGMA automatic_index; <br>PRAGMA automatic_index = </b><i>boolean</i><b>;</b></p> <p>Query, set, or clear the <a href="optoverview.html#autoindex">automatic indexing</a> capability. <p><a href="optoverview.html#autoindex">Automatic indexing</a> is enabled by default as of version 3.7.17, but this might change in future releases of SQLite. <a name="pragma_busy_timeout"></a> <hr> <p><b>PRAGMA busy_timeout; <br>PRAGMA busy_timeout = </b><i>milliseconds</i><b>;</b></p> <p>Query or change the setting of the <a href="c3ref/busy_timeout.html">busy timeout</a>. This pragma is an alternative to the <a href="c3ref/busy_timeout.html">sqlite3_busy_timeout()</a> C-language interface which is made available as a pragma for use with language bindings that do not provide direct access to <a href="c3ref/busy_timeout.html">sqlite3_busy_timeout()</a>. <a name="pragma_cache_size"></a> <hr> <p><b>PRAGMA cache_size; <br>PRAGMA cache_size = </b><i>pages</i><b>; <br>PRAGMA cache_size = -</b><i>kibibytes</i><b>;</b></p> <p>Query or change the suggested maximum number of database disk pages that SQLite will hold in memory at once per open database file. Whether or not this suggestion is honored is at the discretion of the <a href="c3ref/pcache_methods2.html">Application Defined Page Cache</a>. The default page cache that is built into SQLite honors the request, however alternative application-defined page cache implementations may choose to interpret the suggested cache size in different ways or to ignore it all together. The default suggested cache size is 2000 pages.</p> <p>If the argument N is positive then the suggested cache size is set to N. If the argument N is negative, then the number of cache pages is adjusted to use approximately N*1024 bytes of memory. <i>Backwards compatibility note:</i> The behavior of cache_size with a negative N was different in SQLite versions prior to 3.7.10. In version 3.7.9 and earlier, the number of pages in the cache was set to the absolute value of N.</p> <p>When you change the cache size using the cache_size pragma, the change only endures for the current session. The cache size reverts to the default value when the database is closed and reopened.</p> <a name="pragma_cache_spill"></a> <hr> <p><b>PRAGMA cache_spill; <br>PRAGMA cache_spill=</b><i>boolean</i><b>;</b></p> <p>The cache_spill pragma enables or disables the ability of the pager to spill dirty cache pages to the database file in the middle of a transaction. Cache_spill is enabled by default and most applications should leave it that way as cache spilling is usually advantageous. However, a cache spill has the side-effect of acquiring an <a href="lockingv3.html#excl_lock">EXCLUSIVE lock</a> on the database file. Hence, some applications that have large long-running transactions may want to disable cache spilling in order to prevent the application from acquiring an exclusive lock on the database until the moment that the transaction <a href="lang_transaction.html">COMMIT</a>s. <a name="pragma_case_sensitive_like"></a> <hr> <p><b>PRAGMA case_sensitive_like = </b><i>boolean</i><b>;</b></p> <p>The default behavior of the <a href="lang_expr.html#like">LIKE</a> operator is to ignore case for ASCII characters. Hence, by default <b>'a' LIKE 'A'</b> is true. The case_sensitive_like pragma installs a new application-defined LIKE function that is either case sensitive or insensitive depending on the value of the case_sensitive_like pragma. When case_sensitive_like is disabled, the default LIKE behavior is expressed. When case_sensitive_like is enabled, case becomes significant. So, for example, <b>'a' LIKE 'A'</b> is false but <b>'a' LIKE 'a'</b> is still true.</p> <p>This pragma uses <a href="c3ref/create_function.html">sqlite3_create_function()</a> to overload the LIKE and GLOB functions, which may override previous implementations of LIKE and GLOB registered by the application.</p> <a name="pragma_checkpoint_fullfsync"></a> <hr> <p><b>PRAGMA checkpoint_fullfsync <br>PRAGMA checkpoint_fullfsync = </b><i>boolean</i><b>;</b></p> <p>Query or change the fullfsync flag for <a href="wal.html#ckpt">checkpoint</a> operations. If this flag is set, then the F_FULLFSYNC syncing method is used during checkpoint operations on systems that support F_FULLFSYNC. The default value of the checkpoint_fullfsync flag is off. Only Mac OS-X supports F_FULLFSYNC.</p> <p>If the <a href="pragma.html#pragma_fullfsync">fullfsync</a> flag is set, then the F_FULLFSYNC syncing method is used for all sync operations and the checkpoint_fullfsync setting is irrelevant.</p> <a name="pragma_collation_list"></a> <hr> <p><b>PRAGMA collation_list;</b></p> <p>Return a list of the collating sequences defined for the current database connection.</p> <a name="pragma_compile_options"></a> <hr> <p><b>PRAGMA compile_options;</b></p> <p>This pragma returns the names of <a href="compile.html">compile-time options</a> used when building SQLite, one option per row. The "SQLITE_" prefix is omitted from the returned option names. See also the <a href="c3ref/compileoption_get.html">sqlite3_compileoption_get()</a> C/C++ interface and the <a href="lang_corefunc.html#sqlite_compileoption_get">sqlite_compileoption_get()</a> SQL functions.</p> <a name="pragma_count_changes"></a> <hr> <p><b>PRAGMA count_changes; <br>PRAGMA count_changes = </b>boolean</i><b>;</b></p> <p>Query or change the count-changes flag. Normally, when the count-changes flag is not set, <a href="lang_insert.html">INSERT</a>, <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements return no data. When count-changes is set, each of these commands returns a single row of data consisting of one integer value - the number of rows inserted, modified or deleted by the command. The returned change count does not include any insertions, modifications or deletions performed by triggers, or any changes made automatically by <a href="foreignkeys.html#fk_actions">foreign key actions</a>.</p> <p>Another way to get the row change counts is to use the <a href="c3ref/changes.html">sqlite3_changes()</a> or <a href="c3ref/total_changes.html">sqlite3_total_changes()</a> interfaces. There is a subtle different, though. When an INSERT, UPDATE, or DELETE is run against a view using an <a href="lang_createtrigger.html#instead_of_trigger">INSTEAD OF trigger</a>, the count_changes pragma reports the number of rows in the view that fired the trigger, whereas <a href="c3ref/changes.html">sqlite3_changes()</a> and <a href="c3ref/total_changes.html">sqlite3_total_changes()</a> do not. <p style='background-color: #ffd0d0;'> <b>This pragma is deprecated</b> and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity. This pragma may be omitted from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>. </p> <a name="pragma_data_store_directory"></a> <hr> <p><b>PRAGMA data_store_directory; <br>PRAGMA data_store_directory = '</b><i>directory-name</i><b>';</b></p> <p>Query or change the value of the <a href="c3ref/data_directory.html">sqlite3_data_directory</a> global variable, which windows operating-system interface backends use to determine where to store database files specified using a relative pathname.</p> <p>Changing the data_store_directory setting is <u>not</u> threadsafe. Never change the data_store_directory setting if another thread within the application is running any SQLite interface at the same time. Doing so results in undefined behavior. Changing the data_store_directory setting writes to the <a href="c3ref/data_directory.html">sqlite3_data_directory</a> global variable and that global variable is not protected by a mutex.</p> <p>This facility is provided for WinRT which does not have an OS mechanism for reading or changing the current working directory. The use of this pragma in any other context is discouraged and may be disallowed in future releases.</p> <p style='background-color: #ffd0d0;'> <b>This pragma is deprecated</b> and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity. This pragma may be omitted from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>. </p> <a name="pragma_database_list"></a> <hr> <p><b>PRAGMA database_list;</b></p> <p>This pragma works like a query to return one row for each database attached to the current database connection. The second column is the "main" for the main database file, "temp" for the database file used to store TEMP objects, or the name of the ATTACHed database for other database files. The third column is the name of the database file itself, or an empty string if the database is not associated with a file.</p> <a name="pragma_default_cache_size"></a> <hr> <b>PRAGMA default_cache_size; <br>PRAGMA default_cache_size = </b><i>Number-of-pages</i><b>;</b></p> <p>This pragma queries or sets the suggested maximum number of pages of disk cache that will be allocated per open database file. The difference between this pragma and <a href="pragma.html#pragma_cache_size">cache_size</a> is that the value set here persists across database connections. The value of the default cache size is stored in the 4-byte big-endian integer located at offset 48 in the header of the database file. </p> <p style='background-color: #ffd0d0;'> <b>This pragma is deprecated</b> and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity. This pragma may be omitted from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>. </p> <a name="pragma_defer_foreign_keys"></a> <hr> <p><b>PRAGMA defer_foreign_keys <br>PRAGMA defer_foreign_keys = </b><i>boolean</i><b>;</b></p> <p>When the defer_foreign_keys <a href="pragma.html#syntax">PRAGMA</a> is on, enforcement of all <a href="foreignkeys.html">foreign key constraints</a> is delayed until the outermost transaction is committed. The defer_foreign_keys pragma defaults to OFF so that foreign key constraints are only deferred if they are created as "DEFERRABLE INITIALLY DEFERRED". The defer_foreign_keys pragma is automatically switched off at each COMMIT or ROLLBACK. Hence, the defer_foreign_keys pragma must be separately enabled for each transaction. This pragma is only meaningful if foreign key constraints are enabled, of course.</p> <p>The <a href="c3ref/db_status.html">sqlite3_db_status</a>(db,<a href="c3ref/c_dbstatus_options.html#sqlitedbstatusdeferredfks">SQLITE_DBSTATUS_DEFERRED_FKS</a>,...) C-language interface can be used during a transaction to determine if there are deferred and unresolved foreign key constraints.</p> <a name="pragma_empty_result_callbacks"></a> <hr> <p><b>PRAGMA empty_result_callbacks; <br>PRAGMA empty_result_callbacks = </b><i>boolean</i><b>;</b></p> <p>Query or change the empty-result-callbacks flag.</p> <p>The empty-result-callbacks flag affects the <a href="c3ref/exec.html">sqlite3_exec()</a> API only. Normally, when the empty-result-callbacks flag is cleared, the callback function supplied to the <a href="c3ref/exec.html">sqlite3_exec()</a> is not invoked for commands that return zero rows of data. When empty-result-callbacks is set in this situation, the callback function is invoked exactly once, with the third parameter set to 0 (NULL). This is to enable programs that use the <a href="c3ref/exec.html">sqlite3_exec()</a> API to retrieve column-names even when a query returns no data.</p> <p style='background-color: #ffd0d0;'> <b>This pragma is deprecated</b> and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity. This pragma may be omitted from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>. </p> <a name="pragma_encoding"></a> <hr> <p><b>PRAGMA encoding; <br>PRAGMA encoding = "UTF-8"; <br>PRAGMA encoding = "UTF-16"; <br>PRAGMA encoding = "UTF-16le"; <br>PRAGMA encoding = "UTF-16be";</b></p> <p>In first form, if the main database has already been created, then this pragma returns the text encoding used by the main database, one of "UTF-8", "UTF-16le" (little-endian UTF-16 encoding) or "UTF-16be" (big-endian UTF-16 encoding). If the main database has not already been created, then the value returned is the text encoding that will be used to create the main database, if it is created by this session.</p> <p>The second through fifth forms of this pragma set the encoding that the main database will be created with if it is created by this session. The string "UTF-16" is interpreted as "UTF-16 encoding using native machine byte-ordering". It is not possible to change the text encoding of a database after it has been created and any attempt to do so will be silently ignored.</p> <p>Once an encoding has been set for a database, it cannot be changed.</p> <p>Databases created by the <a href="lang_attach.html">ATTACH</a> command always use the same encoding as the main database. An attempt to <a href="lang_attach.html">ATTACH</a> a database with a different text encoding from the "main" database will fail.</p> <a name="pragma_foreign_key_check"></a> <hr> <p><b>PRAGMA foreign_key_check; <br>PRAGMA foreign_key_check(</b><i>table-name</i><b>);</b></b></p> <p>The foreign_key_check pragma checks the database, or the table called "<i>table-name</i>", for <a href="foreignkeys.html">foreign key constraints</a> that are violated and returns one row of output for each violation. There are four columns in each result row. The first column is the name of the table that contains the REFERENCES clause. The second column is the <a href="lang_createtable.html#rowid">rowid</a> of the row that contains the invalid REFERENCES clause. The third column is the name of the table that is referred to. The fourth column is the index of the specific foreign key constraint that failed. The fourth column in the output of the foreign_key_check pragma is the same integer as the first column in the output of the <a href="pragma.html#pragma_foreign_key_list">foreign_key_list pragma</a>. When a "<i>table-name</i>" is specified, the only foreign key constraints checked are those created by REFERENCES clauses in the CREATE TABLE statement for <i>table-name</i>.</p> <a name="pragma_foreign_key_list"></a> <hr> <p><b>PRAGMA foreign_key_list(</b><i>table-name</i><b>);</b></p> <p>This pragma returns one row for each <a href="foreignkeys.html">foreign key constraint</a> created by a REFERENCES clause in the CREATE TABLE statement of table "<i>table-name</i>". <a name="pragma_foreign_keys"></a> <hr> <p><b>PRAGMA foreign_keys; <br>PRAGMA foreign_keys = </b><i>boolean</i><b>;</b></p> <p>Query, set, or clear the enforcement of <a href="foreignkeys.html">foreign key constraints</a>. <p>This pragma is a no-op within a transaction; foreign key constraint enforcement may only be enabled or disabled when there is no pending <a href="lang_transaction.html">BEGIN</a> or <a href="lang_savepoint.html">SAVEPOINT</a>. <p>Changing the foreign_keys setting affects the execution of all statements prepared using the database connection, including those prepared before the setting was changed. Any existing statements prepared using the legacy <a href="c3ref/prepare.html">sqlite3_prepare()</a> interface may fail with an <a href="c3ref/c_abort.html">SQLITE_SCHEMA</a> error after the foreign_keys setting is changed. <p>As of SQLite <a href="releaselog/3_6_19.html">version 3.6.19</a>, the default setting for foreign key enforcement is OFF. However, that might change in a future release of SQLite. The default setting for foreign key enforcement can be specified at compile-time using the <a href="compile.html#default_foreign_keys">SQLITE_DEFAULT_FOREIGN_KEYS</a> preprocessor macro. To minimize future problems, applications should set the foreign key enforcement flag as required by the application and not depend on the default setting. <a name="pragma_freelist_count"></a> <hr> <p><b>PRAGMA freelist_count;</b></p> <p>Return the number of unused pages in the database file.</p> <a name="pragma_full_column_names"></a> <hr> <p><b>PRAGMA full_column_names; <br>PRAGMA full_column_names = </b><i>boolean</i><b>;</b></p> <p>Query or change the full_column_names flag. This flag together with the <a href="pragma.html#pragma_short_column_names">short_column_names</a> flag determine the way SQLite assigns names to result columns of <a href="lang_select.html">SELECT</a> statements. Result columns are named by applying the following rules in order: <ol> <li><p>If there is an AS clause on the result, then the name of the column is the right-hand side of the AS clause.</p></li> <li><p>If the result is a general expression, not a just the name of a source table column, then the name of the result is a copy of the expression text.</p></li> <li><p>If the <a href="pragma.html#pragma_short_column_names">short_column_names</a> pragma is ON, then the name of the result is the name of the source table column without the source table name prefix: COLUMN.</p></li> <li><p>If both pragmas <a href="pragma.html#pragma_short_column_names">short_column_names</a> and <a href="pragma.html#pragma_full_column_names">full_column_names</a> are OFF then case (2) applies. </p></li> <li><p>The name of the result column is a combination of the source table and source column name: TABLE.COLUMN</p></li> </ol> <p style='background-color: #ffd0d0;'> <b>This pragma is deprecated</b> and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity. This pragma may be omitted from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>. </p> <a name="pragma_fullfsync"></a> <hr> <p><b>PRAGMA fullfsync <br>PRAGMA fullfsync = </b><i>boolean</i><b>;</b></p> <p>Query or change the fullfsync flag. This flag determines whether or not the F_FULLFSYNC syncing method is used on systems that support it. The default value of the fullfsync flag is off. Only Mac OS X supports F_FULLFSYNC.</p> <p>See also <a href="pragma.html#pragma_checkpoint_fullfsync">checkpoint_fullfsync</a>.</p> <a name="pragma_ignore_check_constraints"></a> <hr> <p><b>PRAGMA ignore_check_constraints = </b><i>boolean</i><b>;</b></p> <p>This pragma enables or disables the enforcement of CHECK constraints. The default setting is off, meaning that CHECK constraints are enforced by default.</p> <a name="pragma_incremental_vacuum"></a> <hr> <p><b>PRAGMA incremental_vacuum</b><i>(N)</i><b>;</b></p> <p>The incremental_vacuum pragma causes up to <i>N</i> pages to be removed from the <a href="fileformat2.html#freelist">freelist</a>. The database file is truncated by the same amount. The incremental_vacuum pragma has no effect if the database is not in <a href="#pragma_auto_vacuum">auto_vacuum=incremental</a> mode or if there are no pages on the freelist. If there are fewer than <i>N</i> pages on the freelist, or if <i>N</i> is less than 1, or if <i>N</i> is omitted entirely, then the entire freelist is cleared.</p> <a name="pragma_index_info"></a> <hr> <p><b>PRAGMA index_info(</b><i>index-name</i><b>);</b></p> <p>This pragma returns one row each column in the named index. The first column of the result is the rank of the column within the index. The second column of the result is the rank of the column within the table. The third column of output is the name of the column being indexed. </p> <a name="pragma_index_list"></a> <hr> <p><b>PRAGMA index_list(</b><i>table-name</i><b>);</b></p> <p>This pragma returns one row for each index associated with the given table. Columns of the result set include the index name and a flag to indicate whether or not the index is UNIQUE. </p> <a name="pragma_integrity_check"></a> <hr> <p><b>PRAGMA integrity_check; <br>PRAGMA integrity_check(</b><i>N</i><b>)</b></p> <p>This pragma does an integrity check of the entire database. The integrity_check pragma looks for out-of-order records, missing pages, malformed records, and corrupt indices. If the integrity_check pragma finds problems, strings are returned (as multiple rows with a single column per row) which describe the problems. Pragma integrity_check will return at most <i>N</i> errors will be reported before the analysis quits, with N defaulting to 100. If pragma integrity_check finds no errors are found, a single row with the value 'ok' is returned.</p> <a name="pragma_journal_mode"></a> <hr> <p><b>PRAGMA journal_mode; <br>PRAGMA </b><i>database</i><b>.journal_mode; <br>PRAGMA journal_mode = <i>DELETE | TRUNCATE | PERSIST | MEMORY | WAL | OFF</i> <br>PRAGMA </b><i>database</i><b>.journal_mode = <i>DELETE | TRUNCATE | PERSIST | MEMORY | WAL | OFF</i></b></p> <p>This pragma queries or sets the journal mode for databases associated with the current <a href="c3ref/sqlite3.html">database connection</a>.</p> <p>The first two forms of this pragma query the current journaling mode for <i>database</i>. When <i>database</i> is omitted, the "main" database is queried.</p> <p>The last two forms change the journaling mode. The 4th form changes the journaling mode for a specific database connection named. Use "main" for the main database (the database that was opened by the original <a href="c3ref/open.html">sqlite3_open()</a>, <a href="c3ref/open.html">sqlite3_open16()</a>, or <a href="c3ref/open.html">sqlite3_open_v2()</a> interface call) and use "temp" for database that holds TEMP tables. The 3rd form changes the journaling mode on all databases attached to the connection. The new journal mode is returned. If the journal mode could not be changed, the original journal mode is returned.</p> <p>The DELETE journaling mode is the normal behavior. In the DELETE mode, the rollback journal is deleted at the conclusion of each transaction. Indeed, the delete operation is the action that causes the transaction to commit. (See the document titled <a href="atomiccommit.html"> Atomic Commit In SQLite</a> for additional detail.)</p> <p>The TRUNCATE journaling mode commits transactions by truncating the rollback journal to zero-length instead of deleting it. On many systems, truncating a file is much faster than deleting the file since the containing directory does not need to be changed.</p> <p>The PERSIST journaling mode prevents the rollback journal from being deleted at the end of each transaction. Instead, the header of the journal is overwritten with zeros. This will prevent other database connections from rolling the journal back. The PERSIST journaling mode is useful as an optimization on platforms where deleting or truncating a file is much more expensive than overwriting the first block of a file with zeros. See also: <a href="pragma.html#pragma_journal_size_limit">PRAGMA journal_size_limit</a> and <a href="compile.html#default_journal_size_limit">SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT</a>.</p> <p>The MEMORY journaling mode stores the rollback journal in volatile RAM. This saves disk I/O but at the expense of database safety and integrity. If the application using SQLite crashes in the middle of a transaction when the MEMORY journaling mode is set, then the database file will very likely go corrupt.</p> <p>The WAL journaling mode uses a <a href="wal.html">write-ahead log</a> instead of a rollback journal to implement transactions. The WAL journaling mode is persistent; after being set it stays in effect across multiple database connections and after closing and reopening the database. A database in WAL journaling mode can only be accessed by SQLite version 3.7.0 or later.</p> <p>The OFF journaling mode disables the rollback journal completely. No rollback journal is ever created and hence there is never a rollback journal to delete. The OFF journaling mode disables the atomic commit and rollback capabilities of SQLite. The <a href="lang_transaction.html">ROLLBACK</a> command no longer works; it behaves in an undefined way. Applications must avoid using the <a href="lang_transaction.html">ROLLBACK</a> command when the journal mode is OFF. If the application crashes in the middle of a transaction when the OFF journaling mode is set, then the database file will very likely go corrupt.</p> <p>Note that the journal_mode for an <a href="inmemorydb.html">in-memory database</a> is either MEMORY or OFF and can not be changed to a different value. An attempt to change the journal_mode of an <a href="inmemorydb.html">in-memory database</a> to any setting other than MEMORY or OFF is ignored. Note also that the journal_mode cannot be changed while a transaction is active.</p> <a name="pragma_journal_size_limit"></a> <hr> <p><b> PRAGMA journal_size_limit<br> PRAGMA journal_size_limit = </b><i>N</i> <b>;</b> <p>If a database connection is operating in <a href="pragma.html#pragma_locking_mode">exclusive locking mode</a> or in <a href="pragma.html#pragma_journal_mode">persistent journal mode</a> (PRAGMA journal_mode=persist) then after committing a transaction the <a href="lockingv3.html#rollback">rollback journal</a> file may remain in the file-system. This increases performance for subsequent transactions since overwriting an existing file is faster than append to a file, but it also consumes file-system space. After a large transaction (e.g. a <a href="lang_vacuum.html">VACUUM</a>), the rollback journal file may consume a very large amount of space. <p>Similarly, in <a href="wal.html">WAL mode</a>, the write-ahead log file is not truncated following a <a href="wal.html#ckpt">checkpoint</a>. Instead, SQLite reuses the existing file for subsequent WAL entries since overwriting is faster than appending. <p>The journal_size_limit pragma may be used to limit the size of rollback-journal and WAL files left in the file-system after transactions or checkpoints. Each time a transaction is committed or a WAL file resets, SQLite compares the size of the rollback journal file or WAL file left in the file-system to the size limit set by this pragma and if the journal or WAL file is larger it is truncated to the limit. <p>The second form of the pragma listed above is used to set a new limit in bytes for the specified database. A negative number implies no limit. To always truncate rollback journals and WAL files to their minimum size, set the journal_size_limit to zero. Both the first and second forms of the pragma listed above return a single result row containing a single integer column - the value of the journal size limit in bytes. The default journal size limit is -1 (no limit). The <a href="compile.html#default_journal_size_limit">SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT</a> preprocessor macro can be used to change the default journal size limit at compile-time.</p> <p>This pragma only operates on the single database specified prior to the pragma name (or on the "main" database if no database is specified.) There is no way to change the journal size limit on all attached databases using a single PRAGMA statement. The size limit must be set separately for each attached database. <a name="pragma_legacy_file_format"></a> <hr> <p><b>PRAGMA legacy_file_format; <br>PRAGMA legacy_file_format = <i>boolean</i></b></p> <p>This pragma sets or queries the value of the legacy_file_format flag. When this flag is on, new SQLite databases are created in a file format that is readable and writable by all versions of SQLite going back to 3.0.0. When the flag is off, new databases are created using the latest file format which might not be readable or writable by versions of SQLite prior to 3.3.0.</p> <p>When the legacy_file_format pragma is issued with no argument, it returns the setting of the flag. This pragma does <u>not</u> tell which file format the current database is using; it tells what format will be used by any newly created databases.</p> <p>The legacy_file_format pragma is initialized to OFF when an existing database in the newer file format is first opened.</p> <p>The default file format is set by the <a href="compile.html#default_file_format">SQLITE_DEFAULT_FILE_FORMAT</a> compile-time option.</p> <a name="pragma_locking_mode"></a> <hr> <p><b>PRAGMA locking_mode; <br>PRAGMA locking_mode = <i>NORMAL | EXCLUSIVE</i></b></p> <p>This pragma sets or queries the database connection locking-mode. The locking-mode is either NORMAL or EXCLUSIVE. <p>In NORMAL locking-mode (the default unless overridden at compile-time using <a href="compile.html#default_locking_mode">SQLITE_DEFAULT_LOCKING_MODE</a>), a database connection unlocks the database file at the conclusion of each read or write transaction. When the locking-mode is set to EXCLUSIVE, the database connection never releases file-locks. The first time the database is read in EXCLUSIVE mode, a shared lock is obtained and held. The first time the database is written, an exclusive lock is obtained and held.</p> <p>Database locks obtained by a connection in EXCLUSIVE mode may be released either by closing the database connection, or by setting the locking-mode back to NORMAL using this pragma and then accessing the database file (for read or write). Simply setting the locking-mode to NORMAL is not enough - locks are not released until the next time the database file is accessed.</p> <p>There are three reasons to set the locking-mode to EXCLUSIVE. <ol> <li>The application wants to prevent other processes from accessing the database file. <li>The number of system calls for filesystem operations is reduced, possibly resulting in a small performance increase. <li><a href="wal.html">WAL</a> databases can be accessed in EXCLUSIVE mode without the use of shared memory. (<a href="wal.html#noshm">Additional information</a>) </ol> </p> <p>When the locking_mode pragma specifies a particular database, for example:</p> <blockquote> PRAGMA <b>main.</b>locking_mode=EXCLUSIVE; </blockquote> <p>Then the locking mode applies only to the named database. If no database name qualifier precedes the "locking_mode" keyword then the locking mode is applied to all databases, including any new databases added by subsequent <a href="lang_attach.html">ATTACH</a> commands.</p> <p>The "temp" database (in which TEMP tables and indices are stored) and <a href="inmemorydb.html">in-memory databases</a> always uses exclusive locking mode. The locking mode of temp and <a href="inmemorydb.html">in-memory databases</a> cannot be changed. All other databases use the normal locking mode by default and are affected by this pragma.</p> <p>If the locking mode is EXCLUSIVE when first entering <a href="wal.html">WAL journal mode</a>, then the locking mode cannot be changed to NORMAL until after exiting WAL journal mode. If the locking mode is NORMAL when first entering WAL journal mode, then the locking mode can be changed between NORMAL and EXCLUSIVE and back again at any time and without needing to exit WAL journal mode.</p> <a name="pragma_max_page_count"></a> <hr> <p><b>PRAGMA max_page_count; <br>PRAGMA max_page_count = </b><i>N</i><b>;</b></p> <p>Query or set the maximum number of pages in the database file. Both forms of the pragma return the maximum page count. The second form attempts to modify the maximum page count. The maximum page count cannot be reduced below the current database size. </p> <a name="pragma_mmap_size"></a> <hr> <p><br><b>PRAGMA </b><i>database</i><b>.mmap_size; <br>PRAGMA </b><i>database</i><b>.mmap_size=</b><i>N</i></p> <p>Query or change the maximum number of bytes that are set aside for memory-mapped I/O on a single database. The first form (without an argument) queries the current limit. The second form (with a numeric argument) sets the limit for the specified database, or for all databases if the optional database name is omitted. In the second form, if the database name is omitted, the limit that is set becomes the default limit for all databases that are added to the <a href="c3ref/sqlite3.html">database connection</a> by subsequent <a href="lang_attach.html">ATTACH</a> statements.</p> <p>The argument N is the maximum number of bytes of the database file that will be accessed using memory-mapped I/O. If N is zero then memory mapped I/O is disabled. If N is negative, then the limit reverts to the default value determined by the most recent <a href="c3ref/config.html">sqlite3_config</a>(<a href="c3ref/c_config_covering_index_scan.html#sqliteconfigmmapsize">SQLITE_CONFIG_MMAP_SIZE</a>), or to the compile time default determined by <a href="compile.html#default_mmap_size">SQLITE_DEFAULT_MMAP_SIZE</a> if not start-time limit has been set.</p> <p>The <a href="pragma.html#pragma_mmap_size">PRAGMA mmap_size</a> statement will never increase the amount of address space used for memory-mapped I/O above the hard limit set by the <a href="compile.html#max_mmap_size">SQLITE_MAX_MMAP_SIZE</a> compile-time option, nor the hard limit set start-time by the second argument to sqlite3_config(<a href="c3ref/c_config_covering_index_scan.html#sqliteconfigmmapsize">SQLITE_CONFIG_MMAP_SIZE</a>)</p> <p>The size of the memory-mapped I/O region cannot be changed while the memory-mapped I/O region is in active use, to avoid unmapping memory out from under running SQL statements. For this reason, the mmap_size pragma may be a no-op if the prior mmap_size is non-zero and there are other SQL statements running concurrently on the same <a href="c3ref/sqlite3.html">database connection</a>.</p> <a name="pragma_page_count"></a> <hr> <p><b>PRAGMA page_count;</b></p> <p>Return the total number of pages in the database file.</p> <a name="pragma_page_size"></a> <hr> <p><b>PRAGMA page_size; <br>PRAGMA page_size = </b><i>bytes</i><b>;</b></p> <p>Query or set the page size of the database. The page size must be a power of two between 512 and 65536 inclusive. </p> <p>When a new database is created, SQLite assigned a default page size based on information received from the xSectorSize and xDeviceCharacteristics methods of the <a href="c3ref/io_methods.html">sqlite3_io_methods</a> object of the newly created database file. The page_size pragma will only cause an immediate change in the page size if it is issued while the database is still empty, prior to the first CREATE TABLE statement. If the page_size pragma is used to specify a new page size just prior to running the <a href="lang_vacuum.html">VACUUM</a> command and if the database is not in <a href="wal.html">WAL journal mode</a> then <a href="lang_vacuum.html">VACUUM</a> will change the page size to the new value.</p> <p>If SQLite is compiled with the SQLITE_ENABLE_ATOMIC_WRITE option, then the default page size is chosen to be the largest page size less than or equal to SQLITE_MAX_DEFAULT_PAGE_SIZE for which atomic write is enabled according to the xDeviceCharacteristics method of the <a href="c3ref/io_methods.html">sqlite3_io_methods</a> object for the database file. If the SQLITE_ENABLE_ATOMIC_WRITE option is disabled or if xDeviceCharacteristics reports no suitable atomic write page sizes, then the default page size is the larger of SQLITE_DEFAULT_PAGE_SIZE and the sector size as reported by the xSectorSize method of the <a href="c3ref/io_methods.html">sqlite3_io_methods</a> object, but not more than SQLITE_MAX_DEFAULT_PAGE_SIZE. The normal configuration for SQLite running on workstations is for atomic write to be disabled, for the maximum page size to be set to 65536, for SQLITE_DEFAULT_PAGE_SIZE to be 1024, and for the maximum default page size to be set to 8192. The default xSectorSize method on unix workstation implementations always reports a sector size of 512 bytes. Hence, the default page size chosen by SQLite on unix is usually 1024 bytes. On windows, the GetDiskFreeSpace() interface is used to obtain the actual device sector size and hence the default page size on windows will sometimes be greater than 1024.</p> <a name="pragma_parser_trace"></a> <hr> <p><b>PRAGMA parser_trace = </b><i>boolean</i><b>; </b></p> <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option, then the parser_trace pragma can be used to turn on tracing for the SQL parser used internally by SQLite. This feature is used for debugging SQLite itself.</p> <p style='background-color: #f0e0ff;'> This pragma is intended for use when debugging SQLite itself. It is only contained in the build when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option is used.</p> <a name="pragma_query_only"></a> <hr> <p><b>PRAGMA query_only; <br>PRAGMA query_only = </b><i>boolean</i><b>;</b></p> <p>The query_only pragma prevents all changes to database files when enabled.</p> <a name="pragma_quick_check"></a> <hr> <p><b>PRAGMA quick_check; <br>PRAGMA quick_check(</b><i>N</i><b>)</b></p> <p>The pragma is like <a href="pragma.html#pragma_integrity_check">integrity_check</a> except that it does not verify that index content matches table content. By skipping the verification of index content, quick_check is able to run much faster than integrity_check. Otherwise the two pragmas are the same. </p> <a name="pragma_read_uncommitted"></a> <hr> <p><b>PRAGMA read_uncommitted; <br>PRAGMA read_uncommitted = </b><i>boolean</i><b>;</b></p> <p>Query, set, or clear READ UNCOMMITTED isolation. The default isolation level for SQLite is SERIALIZABLE. Any process or thread can select READ UNCOMMITTED isolation, but SERIALIZABLE will still be used except between connections that share a common page and schema cache. Cache sharing is enabled using the <a href="c3ref/enable_shared_cache.html">sqlite3_enable_shared_cache()</a> API. Cache sharing is disabled by default. </p> <p>See <a href="sharedcache.html">SQLite Shared-Cache Mode</a> for additional information.</p> <a name="pragma_recursive_triggers"></a> <hr> <p><b>PRAGMA recursive_triggers; <br>PRAGMA recursive_triggers = </b><i>boolean</i><b>;</b></p> <p>Query, set, or clear the recursive trigger capability. <p>Changing the recursive_triggers setting affects the execution of all statements prepared using the database connection, including those prepared before the setting was changed. Any existing statements prepared using the legacy <a href="c3ref/prepare.html">sqlite3_prepare()</a> interface may fail with an <a href="c3ref/c_abort.html">SQLITE_SCHEMA</a> error after the recursive_triggers setting is changed. <p>Prior to SQLite version 3.6.18, recursive triggers were not supported. The behavior of SQLite was always as if this pragma was set to OFF. Support for recursive triggers was added in version 3.6.18 but was initially turned OFF by default, for compatibility. Recursive triggers may be turned on by default in future versions of SQLite. </p> <p>The depth of recursion for triggers has a hard upper limit set by the <a href="limits.html#max_trigger_depth">SQLITE_MAX_TRIGGER_DEPTH</a> compile-time option and a run-time limit set by <a href="c3ref/limit.html">sqlite3_limit</a>(db,<a href="c3ref/c_limit_attached.html#sqlitelimittriggerdepth">SQLITE_LIMIT_TRIGGER_DEPTH</a>,...).</p> <a name="pragma_reverse_unordered_selects"></a> <hr> <p><b>PRAGMA reverse_unordered_selects; <br>PRAGMA reverse_unordered_selects = </b><i>boolean</i><b>;</b></p> <p>When enabled, this PRAGMA causes <a href="lang_select.html">SELECT</a> statements without an ORDER BY clause to emit their results in the reverse order of what they normally would. This can help debug applications that are making invalid assumptions about the result order.<p>SQLite makes no guarantees about the order of results if a SELECT omits the ORDER BY clause. Even so, the order of results does not change from one run to the next, and so many applications mistakenly come to depend on the arbitrary output order whatever that order happens to be. However, sometimes new versions of SQLite will contain optimizer enhancements that will cause the output order of queries without ORDER BY clauses to shift. When that happens, applications that depend on a certain output order might malfunction. By running the application multiple times with this pragma both disabled and enabled, cases where the application makes faulty assumptions about output order can be identified and fixed early, reducing problems that might be caused by linking against a different version of SQLite. </p> <a name="pragma_schema_version"></a> <hr> <p><b>PRAGMA schema_version; <br>PRAGMA schema_version = </b><i>integer </i><b>; <br>PRAGMA user_version; <br>PRAGMA user_version = </b><i>integer </i><b>;</b> <p> The pragmas schema_version and user_version are used to set or get the value of the schema-version and user-version, respectively. The schema-version and the user-version are big-endian 32-bit signed integers stored in the database header at offsets 40 and 60, respectively.</p> <p> The schema-version is usually only manipulated internally by SQLite. It is incremented by SQLite whenever the database schema is modified (by creating or dropping a table or index). The schema version is used by SQLite each time a query is executed to ensure that the internal cache of the schema used when compiling the SQL query matches the schema of the database against which the compiled query is actually executed. Subverting this mechanism by using "PRAGMA schema_version" to modify the schema-version is potentially dangerous and may lead to program crashes or database corruption. Use with caution!</p> <p> The user-version is not used internally by SQLite. It may be used by applications for any purpose.</p> <a name="pragma_secure_delete"></a> <hr> <p><b>PRAGMA secure_delete; <br>PRAGMA </b><i>database</i><b>.secure_delete; <br>PRAGMA secure_delete = </b><i>boolean</i><b> <br>PRAGMA </b><i>database</i><b>.secure_delete = </b><i>boolean</i></p> <p>Query or change the secure-delete setting. When secure-delete on, SQLite overwrites deleted content with zeros. The default setting is determined by the <a href="compile.html#secure_delete">SQLITE_SECURE_DELETE</a> compile-time option. <p> When there are <a href="lang_attach.html">attached databases</a> and no database is specified in the pragma, all databases have their secure-delete setting altered. The secure-delete setting for newly attached databases is the setting of the main database at the time the ATTACH command is evaluated. <p> When multiple database connections share the same cache, changing the secure-delete flag on one database connection changes it for them all. </p> <a name="pragma_short_column_names"></a> <hr> <p><b>PRAGMA short_column_names; <br>PRAGMA short_column_names = </b><i>boolean</i><b>;</b></p> <p>Query or change the short-column-names flag. This flag affects the way SQLite names columns of data returned by <a href="lang_select.html">SELECT</a> statements. See the <a href="pragma.html#pragma_full_column_names">full_column_names</a> pragma for full details. </p> <p style='background-color: #ffd0d0;'> <b>This pragma is deprecated</b> and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity. This pragma may be omitted from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>. </p> <a name="pragma_shrink_memory"></a> <hr> <p><b>PRAGMA shrink_memory</b></p> <p>This pragma causes the database connection on which it is invoked to free up as much memory as it can, by calling <a href="c3ref/db_release_memory.html">sqlite3_db_release_memory()</a>. </p> <a name="pragma_soft_heap_limit"></a> <hr> <p><b>PRAGMA soft_heap_limit<br> PRAGMA soft_heap_limit=</b><i>N</i></p> <p>This pragma invokes the <a href="c3ref/soft_heap_limit64.html">sqlite3_soft_heap_limit64()</a> interface with the argument N, if N is specified and is a non-negative integer. The soft_heap_limit pragma always returns the same integer that would be returned by the <a href="c3ref/soft_heap_limit64.html">sqlite3_soft_heap_limit64</a>(-1) C-language function. </p> <a name="pragma_stats"></a> <hr> <p><b>PRAGMA stats;</b> </p> <p>This pragma returns auxiliary information about tables and indices. The returned information is used during testing to help verify that the query planner is operating correctly. The format and meaning of this pragma will likely change from release to the next. Because of its volatility, the behavior and output format of this pragma are deliberately undocumented. This pragma is intended for interactive, debugging, and testing use only. Applications should avoid using this pragma.</p> <a name="pragma_synchronous"></a> <hr> <p><b>PRAGMA synchronous; <br>PRAGMA synchronous = </b> <i>0 | OFF | 1 | NORMAL | 2 | FULL</i><b>;</b></p> <p>Query or change the setting of the "synchronous" flag. The first (query) form will return the synchronous setting as an integer. When synchronous is FULL (2), the SQLite database engine will use the xSync method of the <a href="vfs.html">VFS</a> to ensure that all content is safely written to the disk surface prior to continuing. This ensures that an operating system crash or power failure will not corrupt the database. FULL synchronous is very safe, but it is also slower. When synchronous is NORMAL (1), the SQLite database engine will still sync at the most critical moments, but less often than in FULL mode. There is a very small (though non-zero) chance that a power failure at just the wrong time could corrupt the database in NORMAL mode. But in practice, you are more likely to suffer a catastrophic disk failure or some other unrecoverable hardware fault. With synchronous OFF (0), SQLite continues without syncing as soon as it has handed data off to the operating system. If the application running SQLite crashes, the data will be safe, but the database might become corrupted if the operating system crashes or the computer loses power before that data has been written to the disk surface. On the other hand, some operations are as much as 50 or more times faster with synchronous OFF. </p> <p>In <a href="wal.html">WAL</a> mode when synchronous is NORMAL (1), the WAL file is synchronized before each <a href="wal.html#ckpt">checkpoint</a> and the database file is synchronized after each completed <a href="wal.html#ckpt">checkpoint</a> and the WAL file header is synchronized when a WAL file begins to be reused after a checkpoint, but no sync operations occur during most transactions. With synchronous=FULL in WAL mode, an additional sync operation of the WAL file happens after each transaction commit. The extra WAL sync following each transaction help ensure that transactions are durable across a power loss, but they do not aid in preserving consistency. If durability is not a concern, then synchronous=NORMAL is normally all one needs in WAL mode.</p> <p>The default setting is synchronous=FULL.</p> <p>See also the <a href="pragma.html#pragma_fullfsync">fullfsync</a> and <a href="pragma.html#pragma_checkpoint_fullfsync">checkpoint_fullfsync</a> pragmas.</p> <a name="pragma_table_info"></a> <hr> <p><b>PRAGMA table_info(</b><i>table-name</i><b>);</b></p> <p>This pragma returns one row for each column in the named table. Columns in the result set include the column name, data type, whether or not the column can be NULL, and the default value for the column. The "pk" column in the result set is zero for columns that are not part of the primary key, and is the index of the column in the primary key for columns that are part of the primary key.</p> <a name="pragma_temp_store"></a> <hr> <p><b>PRAGMA temp_store; <br>PRAGMA temp_store = </b> <i>0 | DEFAULT | 1 | FILE | 2 | MEMORY</i><b>;</b></p> <p>Query or change the setting of the "<b>temp_store</b>" parameter. When temp_store is DEFAULT (0), the compile-time C preprocessor macro <a href="compile.html#temp_store">SQLITE_TEMP_STORE</a> is used to determine where temporary tables and indices are stored. When temp_store is MEMORY (2) <a href="inmemorydb.html#temp_db">temporary tables</a> and indices are kept in as if they were pure <a href="inmemorydb.html">in-memory databases</a> memory. When temp_store is FILE (1) <a href="inmemorydb.html#temp_db">temporary tables</a> and indices are stored in a file. The <a href="pragma.html#pragma_temp_store_directory">temp_store_directory</a> pragma can be used to specify the directory containing temporary files when <b>FILE</b> is specified. When the temp_store setting is changed, all existing temporary tables, indices, triggers, and views are immediately deleted.</p> <p>It is possible for the library compile-time C preprocessor symbol <a href="compile.html#temp_store">SQLITE_TEMP_STORE</a> to override this pragma setting. The following table summarizes the interaction of the <a href="compile.html#temp_store">SQLITE_TEMP_STORE</a> preprocessor macro and the temp_store pragma:</p> <blockquote> <table cellpadding="2" border="1"> <tr><th valign="bottom"><a href="compile.html#temp_store">SQLITE_TEMP_STORE</a></th> <th valign="bottom">PRAGMA<br>temp_store</th> <th>Storage used for<br>TEMP tables and indices</th></tr> <tr><td align="center">0</td> <td align="center"><em>any</em></td> <td align="center">file</td></tr> <tr><td align="center">1</td> <td align="center">0</td> <td align="center">file</td></tr> <tr><td align="center">1</td> <td align="center">1</td> <td align="center">file</td></tr> <tr><td align="center">1</td> <td align="center">2</td> <td align="center">memory</td></tr> <tr><td align="center">2</td> <td align="center">0</td> <td align="center">memory</td></tr> <tr><td align="center">2</td> <td align="center">1</td> <td align="center">file</td></tr> <tr><td align="center">2</td> <td align="center">2</td> <td align="center">memory</td></tr> <tr><td align="center">3</td> <td align="center"><em>any</em></td> <td align="center">memory</td></tr> </table> </blockquote> <a name="pragma_temp_store_directory"></a> <hr> <p><b>PRAGMA temp_store_directory; <br>PRAGMA temp_store_directory = '</b><i>directory-name</i><b>';</b></p> <p>Query or change the value of the <a href="c3ref/temp_directory.html">sqlite3_temp_directory</a> global variable, which many operating-system interface backends use to determine where to store <a href="inmemorydb.html#temp_db">temporary tables</a> and indices.</p> <p>When the temp_store_directory setting is changed, all existing temporary tables, indices, triggers, and viewers in the database connection that issued the pragma are immediately deleted. In practice, temp_store_directory should be set immediately after the first database connection for a process is opened. If the temp_store_directory is changed for one database connection while other database connections are open in the same process, then the behavior is undefined and probably undesirable.</p> <p>Changing the temp_store_directory setting is <u>not</u> threadsafe. Never change the temp_store_directory setting if another thread within the application is running any SQLite interface at the same time. Doing so results in undefined behavior. Changing the temp_store_directory setting writes to the <a href="c3ref/temp_directory.html">sqlite3_temp_directory</a> global variable and that global variable is not protected by a mutex.</p> <p>The value <i>directory-name</i> should be enclosed in single quotes. To revert the directory to the default, set the <i>directory-name</i> to an empty string, e.g., <i>PRAGMA temp_store_directory = ''</i>. An error is raised if <i>directory-name</i> is not found or is not writable. </p> <p>The default directory for temporary files depends on the OS. Some OS interfaces may choose to ignore this variable and place temporary files in some other directory different from the directory specified here. In that sense, this pragma is only advisory.</p> <p style='background-color: #ffd0d0;'> <b>This pragma is deprecated</b> and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity. This pragma may be omitted from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>. </p> <a name="pragma_vdbe_addoptrace"></a> <hr> <p><b>PRAGMA vdbe_addoptrace = </b><i>boolean</i><b>;</b></p> <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option, then the vdbe_addoptrace pragma can be used to cause a complete VDBE opcodes to be displayed as they are created during code generation. This feature is used for debugging SQLite itself. See the <a href="vdbe.html#trace">VDBE documentation</a> for more information.</p> <p style='background-color: #f0e0ff;'> This pragma is intended for use when debugging SQLite itself. It is only contained in the build when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option is used.</p> <a name="pragma_vdbe_debug"></a> <hr> <p><b>PRAGMA vdbe_debug = </b><i>boolean</i><b>;</b></p> <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option, then the vdbe_debug pragma is a shorthand for three other debug-only pragmas: vdbe_addoptrace, vdbe_listing, and vdbe_trace. This feature is used for debugging SQLite itself. See the <a href="vdbe.html#trace">VDBE documentation</a> for more information.</p> <p style='background-color: #f0e0ff;'> This pragma is intended for use when debugging SQLite itself. It is only contained in the build when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option is used.</p> <a name="pragma_vdbe_listing"></a> <hr> <p><b>PRAGMA vdbe_listing = </b><i>boolean</i><b>;</b></p> <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option, then the vdbe_listing pragma can be used to cause a complete listing of the virtual machine opcodes to appear on standard output as each statement is evaluated. With listing is on, the entire content of a program is printed just prior to beginning execution. The statement executes normally after the listing is printed. This feature is used for debugging SQLite itself. See the <a href="vdbe.html#trace">VDBE documentation</a> for more information.</p> <p style='background-color: #f0e0ff;'> This pragma is intended for use when debugging SQLite itself. It is only contained in the build when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option is used.</p> <a name="pragma_vdbe_trace"></a> <hr> <p><b>PRAGMA vdbe_trace = </b><i>boolean</i><b>;</b></p> <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option, then the vdbe_trace pragma can be used to cause virtual machine opcodes to be printed on standard output as they are evaluated. This feature is used for debugging SQLite. See the <a href="vdbe.html#trace">VDBE documentation</a> for more information.</p> <p style='background-color: #f0e0ff;'> This pragma is intended for use when debugging SQLite itself. It is only contained in the build when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option is used.</p> <a name="pragma_wal_autocheckpoint"></a> <hr> <p><b>PRAGMA wal_autocheckpoint;<br> PRAGMA wal_autocheckpoint=</b><i>N</i><b>;</b></p> <p>This pragma queries or sets the <a href="wal.html">write-ahead log</a> <a href="wal.html#ckpt">auto-checkpoint</a> interval. When the <a href="wal.html">write-ahead log</a> is enabled (via the <a href="pragma.html#pragma_journal_mode">journal_mode pragma</a>) a checkpoint will be run automatically whenever the write-ahead log equals or exceeds <i>N</i> pages in length. Setting the auto-checkpoint size to zero or a negative value turns auto-checkpointing off.</p> <p>This pragma is a wrapper around the <a href="c3ref/wal_autocheckpoint.html">sqlite3_wal_autocheckpoint()</a> C interface.</p> <p>Autocheckpointing is enabled by default with an interval of 1000 or <a href="compile.html#default_wal_autocheckpoint">SQLITE_DEFAULT_WAL_AUTOCHECKPOINT</a>.</p> <a name="pragma_wal_checkpoint"></a> <hr> <p><b>PRAGMA </b><i>database</i><b>.wal_checkpoint;</b><br> <b>PRAGMA </b><i>database</i><b>.wal_checkpoint(PASSIVE);</b><br> <b>PRAGMA </b><i>database</i><b>.wal_checkpoint(FULL);</b><br> <b>PRAGMA </b><i>database</i><b>.wal_checkpoint(RESTART);</b> </p> <p>If the <a href="wal.html">write-ahead log</a> is enabled (via the <a href="pragma.html#pragma_journal_mode">journal_mode pragma</a>), this pragma causes a <a href="wal.html#ckpt">checkpoint</a> operation to run on database <i>database</i>, or on all attached databases if <i>database</i> is omitted. If <a href="wal.html">write-ahead log</a> mode is disabled, this pragma is a harmless no-op.</p> <p>Invoking this pragma is equivalent to calling the <a href="c3ref/wal_checkpoint_v2.html">sqlite3_wal_checkpoint_v2()</a> C interface with a <a href="c3ref/c_checkpoint_full.html">3rd parameter</a> corresponding to the argument of the PRAGMA. Invoking this pragma without an argument is equivalent to calling the <a href="c3ref/wal_checkpoint.html">sqlite3_wal_checkpoint()</a> C interface.</p> <p>The wal_checkpoint pragma returns a single row with three integer columns. The first column is usually 0 but will be 1 if a RESTART or FULL checkpoint was blocked from completing, for example because another thread or process was actively using the database. In other words, the first column is 0 if the equivalent call to <a href="c3ref/wal_checkpoint_v2.html">sqlite3_wal_checkpoint_v2()</a> would have returned <a href="c3ref/c_abort.html">SQLITE_OK</a> or 1 if the equivalent call would have returned <a href="c3ref/c_abort.html">SQLITE_BUSY</a>. The second column is the number of modified pages that have been written to the write-ahead log file. The third column is the number of pages in the write-ahead log file that have been successfully moved back into the database file at the conclusion of the checkpoint. The second and third column are -1 if there is no write-ahead log, for example if this pragma is invoked on a database connection that is not in <a href="wal.html">WAL mode</a>.</p> <a name="pragma_writable_schema"></a> <hr> <p><b>PRAGMA writable_schema = </b><i>boolean</i><b>;</b></p> <p>When this pragma is on, the SQLITE_MASTER tables in which database can be changed using ordinary <a href="lang_update.html">UPDATE</a>, <a href="lang_insert.html">INSERT</a>, and <a href="lang_delete.html">DELETE</a> statements. Warning: misuse of this pragma can easily result in a corrupt database file.</p> <hr> |
Deleted Doc/Extra/Core/syntax.html.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Added Doc/Extra/Core/syntaxdiagrams.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 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 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Syntax Diagrams For SQLite</title> <style type="text/css"> body { margin: auto; font-family: Verdana, sans-serif; padding: 8px 1%; } a { color: #044a64 } a:visited { color: #734559 } .logo { position:absolute; margin:3px; } .tagline { float:right; text-align:right; font-style:italic; width:300px; margin:12px; margin-top:58px; } .menubar { clear: both; border-radius: 8px; background: #044a64; padding: 0px; margin: 0px; cell-spacing: 0px; } .toolbar { text-align: center; line-height: 1.6em; margin: 0; padding: 0px 8px; } .toolbar a { color: white; text-decoration: none; padding: 6px 12px; } .toolbar a:visited { color: white; } .toolbar a:hover { color: #044a64; background: white; } .content { margin: 5%; } .content dt { font-weight:bold; } .content dd { margin-bottom: 25px; margin-left:20%; } .content ul { padding:0px; padding-left: 15px; margin:0px; } /* Things for "fancyformat" documents start here. */ .fancy img+p {font-style:italic} .fancy .codeblock i { color: darkblue; } .fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64} .fancy h2 { margin-left: 10px } .fancy h3 { margin-left: 20px } .fancy h4 { margin-left: 30px } .fancy th {white-space:nowrap;text-align:left;border-bottom:solid 1px #444} .fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top} .fancy #toc a { color: darkblue ; text-decoration: none } .fancy .todo { color: #AA3333 ; font-style : italic } .fancy .todo:before { content: 'TODO:' } .fancy p.todo { border: solid #AA3333 1px; padding: 1ex } .fancy img { display:block; } .fancy :link:hover, .fancy :visited:hover { background: wheat } .fancy p,.fancy ul,.fancy ol { margin: 1em 5ex } .fancy li p { margin: 1em 0 } /* End of "fancyformat" specific rules. */ </style> </head> <body> <div><!-- container div to satisfy validator --> <a href="index.html"> <img class="logo" src="images/sqlite370_banner.gif" alt="SQLite Logo" border="0"></a> <div><!-- IE hack to prevent disappearing logo--></div> <div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div> <table width=100% class="menubar"><tr> <td width=100%> <div class="toolbar"> <a href="about.html">About</a> <a href="sitemap.html">Sitemap</a> <a href="docs.html">Documentation</a> <a href="download.html">Download</a> <a href="copyright.html">License</a> <a href="news.html">News</a> <a href="support.html">Support</a> </div> <script> gMsg = "Search SQLite Docs..." function entersearch() { var q = document.getElementById("q"); if( q.value == gMsg ) { q.value = "" } q.style.color = "black" q.style.fontStyle = "normal" } function leavesearch() { var q = document.getElementById("q"); if( q.value == "" ) { q.value = gMsg q.style.color = "#044a64" q.style.fontStyle = "italic" } } function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } </script> <td> <div style="padding:0 1em 0px 0;white-space:nowrap"> <form name=f method="GET" action="http://www.sqlite.org/search"> <input id=q name=q type=text onfocus="entersearch()" onblur="leavesearch()" style="width:24ex;padding:1px 1ex; border:solid white 1px; font-size:0.9em ; font-style:italic;color:#044a64;" value="Search SQLite Docs..."> <input type=submit value="Go" style="border:solid white 1px;background-color:#044a64;color:white;font-size:0.9em;padding:0 1ex"> </form> </div> </table> <div class=startsearch></div> <h1 align=center>Syntax Diagrams For SQLite</h1> <a name="sql-stmt-list"></a> <h4>sql-stmt-list:</h4><blockquote> <img src="images/syntax/sql-stmt-list.gif"></img><br></br><br></br> References: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang.html">lang.html</a> </blockquote> <a name="sql-stmt"></a> <h4>sql-stmt:</h4><blockquote> <img src="images/syntax/sql-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt-list">sql-stmt-list</a><br></br> References: <a href="#alter-table-stmt">alter-table-stmt</a> <a href="#analyze-stmt">analyze-stmt</a> <a href="#attach-stmt">attach-stmt</a> <a href="#begin-stmt">begin-stmt</a> <a href="#commit-stmt">commit-stmt</a> <a href="#create-index-stmt">create-index-stmt</a> <a href="#create-table-stmt">create-table-stmt</a> <a href="#create-trigger-stmt">create-trigger-stmt</a> <a href="#create-view-stmt">create-view-stmt</a> <a href="#create-virtual-table-stmt">create-virtual-table-stmt</a> <a href="#delete-stmt">delete-stmt</a> <a href="#delete-stmt-limited">delete-stmt-limited</a> <a href="#detach-stmt">detach-stmt</a> <a href="#drop-index-stmt">drop-index-stmt</a> <a href="#drop-table-stmt">drop-table-stmt</a> <a href="#drop-trigger-stmt">drop-trigger-stmt</a> <a href="#drop-view-stmt">drop-view-stmt</a> <a href="#insert-stmt">insert-stmt</a> <a href="#pragma-stmt">pragma-stmt</a> <a href="#reindex-stmt">reindex-stmt</a> <a href="#release-stmt">release-stmt</a> <a href="#rollback-stmt">rollback-stmt</a> <a href="#savepoint-stmt">savepoint-stmt</a> <a href="#select-stmt">select-stmt</a> <a href="#update-stmt">update-stmt</a> <a href="#update-stmt-limited">update-stmt-limited</a> <a href="#vacuum-stmt">vacuum-stmt</a><br></br> See also: <a href="lang.html">lang.html</a> <a href="lang_explain.html">lang_explain.html</a> </blockquote> <a name="alter-table-stmt"></a> <h4>alter-table-stmt:</h4><blockquote> <img src="images/syntax/alter-table-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#column-def">column-def</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> </blockquote> <a name="analyze-stmt"></a> <h4>analyze-stmt:</h4><blockquote> <img src="images/syntax/analyze-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_analyze.html">lang_analyze.html</a> </blockquote> <a name="attach-stmt"></a> <h4>attach-stmt:</h4><blockquote> <img src="images/syntax/attach-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#expr">expr</a><br></br> See also: <a href="lang_attach.html">lang_attach.html</a> </blockquote> <a name="begin-stmt"></a> <h4>begin-stmt:</h4><blockquote> <img src="images/syntax/begin-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_transaction.html">lang_transaction.html</a> </blockquote> <a name="commit-stmt"></a> <h4>commit-stmt:</h4><blockquote> <img src="images/syntax/commit-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a> </blockquote> <a name="rollback-stmt"></a> <h4>rollback-stmt:</h4><blockquote> <img src="images/syntax/rollback-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a> </blockquote> <a name="savepoint-stmt"></a> <h4>savepoint-stmt:</h4><blockquote> <img src="images/syntax/savepoint-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_savepoint.html">lang_savepoint.html</a> </blockquote> <a name="release-stmt"></a> <h4>release-stmt:</h4><blockquote> <img src="images/syntax/release-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a> </blockquote> <a name="create-index-stmt"></a> <h4>create-index-stmt:</h4><blockquote> <img src="images/syntax/create-index-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#expr">expr</a> <a href="#indexed-column">indexed-column</a><br></br> See also: <a href="lang_createindex.html">lang_createindex.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="indexed-column"></a> <h4>indexed-column:</h4><blockquote> <img src="images/syntax/indexed-column.gif"></img><br></br> Used by: <a href="#create-index-stmt">create-index-stmt</a> <a href="#table-constraint">table-constraint</a><br></br> See also: <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="create-table-stmt"></a> <h4>create-table-stmt:</h4><blockquote> <img src="images/syntax/create-table-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#column-def">column-def</a> <a href="#select-stmt">select-stmt</a> <a href="#table-constraint">table-constraint</a><br></br> See also: <a href="lang_createtable.html">lang_createtable.html</a> </blockquote> <a name="column-def"></a> <h4>column-def:</h4><blockquote> <img src="images/syntax/column-def.gif"></img><br></br> Used by: <a href="#alter-table-stmt">alter-table-stmt</a> <a href="#create-table-stmt">create-table-stmt</a><br></br> References: <a href="#column-constraint">column-constraint</a> <a href="#type-name">type-name</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtable.html#tablecoldef">lang_createtable.html#tablecoldef</a> </blockquote> <a name="type-name"></a> <h4>type-name:</h4><blockquote> <img src="images/syntax/type-name.gif"></img><br></br> Used by: <a href="#column-def">column-def</a> <a href="#expr">expr</a><br></br> References: <a href="#signed-number">signed-number</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="column-constraint"></a> <h4>column-constraint:</h4><blockquote> <img src="images/syntax/column-constraint.gif"></img><br></br> Used by: <a href="#column-def">column-def</a><br></br> References: <a href="#conflict-clause">conflict-clause</a> <a href="#expr">expr</a> <a href="#foreign-key-clause">foreign-key-clause</a> <a href="#literal-value">literal-value</a> <a href="#signed-number">signed-number</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtable.html#tablecoldef">lang_createtable.html#tablecoldef</a> </blockquote> <a name="signed-number"></a> <h4>signed-number:</h4><blockquote> <img src="images/syntax/signed-number.gif"></img><br></br> Used by: <a href="#column-constraint">column-constraint</a> <a href="#pragma-value">pragma-value</a> <a href="#type-name">type-name</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> <a href="pragma.html#syntax">pragma.html#syntax</a> </blockquote> <a name="table-constraint"></a> <h4>table-constraint:</h4><blockquote> <img src="images/syntax/table-constraint.gif"></img><br></br> Used by: <a href="#create-table-stmt">create-table-stmt</a><br></br> References: <a href="#conflict-clause">conflict-clause</a> <a href="#expr">expr</a> <a href="#foreign-key-clause">foreign-key-clause</a> <a href="#indexed-column">indexed-column</a><br></br> See also: <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtable.html#primkeyconst">lang_createtable.html#primkeyconst</a> <a href="lang_createtable.html#tablecoldef">lang_createtable.html#tablecoldef</a> </blockquote> <a name="foreign-key-clause"></a> <h4>foreign-key-clause:</h4><blockquote> <img src="images/syntax/foreign-key-clause.gif"></img><br></br> Used by: <a href="#column-constraint">column-constraint</a> <a href="#table-constraint">table-constraint</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_createtable.html">lang_createtable.html</a> </blockquote> <a name="conflict-clause"></a> <h4>conflict-clause:</h4><blockquote> <img src="images/syntax/conflict-clause.gif"></img><br></br> Used by: <a href="#column-constraint">column-constraint</a> <a href="#table-constraint">table-constraint</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_conflict.html">lang_conflict.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtable.html#notnullconst">lang_createtable.html#notnullconst</a> </blockquote> <a name="create-trigger-stmt"></a> <h4>create-trigger-stmt:</h4><blockquote> <img src="images/syntax/create-trigger-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#delete-stmt">delete-stmt</a> <a href="#expr">expr</a> <a href="#insert-stmt">insert-stmt</a> <a href="#select-stmt">select-stmt</a> <a href="#update-stmt">update-stmt</a><br></br> See also: <a href="lang_createtrigger.html">lang_createtrigger.html</a> </blockquote> <a name="create-view-stmt"></a> <h4>create-view-stmt:</h4><blockquote> <img src="images/syntax/create-view-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#select-stmt">select-stmt</a><br></br> See also: <a href="lang_createview.html">lang_createview.html</a> </blockquote> <a name="create-virtual-table-stmt"></a> <h4>create-virtual-table-stmt:</h4><blockquote> <img src="images/syntax/create-virtual-table-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_createvtab.html">lang_createvtab.html</a> </blockquote> <a name="with-clause"></a> <h4>with-clause:</h4><blockquote> <img src="images/syntax/with-clause.gif"></img><br></br> Used by: <a href="#delete-stmt">delete-stmt</a> <a href="#delete-stmt-limited">delete-stmt-limited</a> <a href="#insert-stmt">insert-stmt</a> <a href="#update-stmt">update-stmt</a> <a href="#update-stmt-limited">update-stmt-limited</a><br></br> References: <a href="#cte-table-name">cte-table-name</a> <a href="#select-stmt">select-stmt</a><br></br> See also: <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> </blockquote> <a name="cte-table-name"></a> <h4>cte-table-name:</h4><blockquote> <img src="images/syntax/cte-table-name.gif"></img><br></br> Used by: <a href="#recursive-cte">recursive-cte</a> <a href="#with-clause">with-clause</a><br></br> See also: <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="lang_with.html#recursivecte">lang_with.html#recursivecte</a> </blockquote> <a name="recursive-cte"></a> <h4>recursive-cte:</h4><blockquote> <img src="images/syntax/recursive-cte.gif"></img><br></br><br></br> References: <a href="#cte-table-name">cte-table-name</a><br></br> See also: <a href="lang_with.html#recursivecte">lang_with.html#recursivecte</a> </blockquote> <a name="common-table-expression"></a> <h4>common-table-expression:</h4><blockquote> <img src="images/syntax/common-table-expression.gif"></img><br></br> Used by: <a href="#compound-select-stmt">compound-select-stmt</a> <a href="#factored-select-stmt">factored-select-stmt</a> <a href="#select-stmt">select-stmt</a> <a href="#simple-select-stmt">simple-select-stmt</a><br></br> References: <a href="#select-stmt">select-stmt</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="delete-stmt"></a> <h4>delete-stmt:</h4><blockquote> <img src="images/syntax/delete-stmt.gif"></img><br></br> Used by: <a href="#create-trigger-stmt">create-trigger-stmt</a> <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#expr">expr</a> <a href="#qualified-table-name">qualified-table-name</a> <a href="#with-clause">with-clause</a><br></br> See also: <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_delete.html">lang_delete.html</a> </blockquote> <a name="delete-stmt-limited"></a> <h4>delete-stmt-limited:</h4><blockquote> <img src="images/syntax/delete-stmt-limited.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#expr">expr</a> <a href="#ordering-term">ordering-term</a> <a href="#qualified-table-name">qualified-table-name</a> <a href="#with-clause">with-clause</a><br></br> See also: <a href="lang_delete.html">lang_delete.html</a> </blockquote> <a name="detach-stmt"></a> <h4>detach-stmt:</h4><blockquote> <img src="images/syntax/detach-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_detach.html">lang_detach.html</a> </blockquote> <a name="drop-index-stmt"></a> <h4>drop-index-stmt:</h4><blockquote> <img src="images/syntax/drop-index-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_dropindex.html">lang_dropindex.html</a> </blockquote> <a name="drop-table-stmt"></a> <h4>drop-table-stmt:</h4><blockquote> <img src="images/syntax/drop-table-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_droptable.html">lang_droptable.html</a> </blockquote> <a name="drop-trigger-stmt"></a> <h4>drop-trigger-stmt:</h4><blockquote> <img src="images/syntax/drop-trigger-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_droptrigger.html">lang_droptrigger.html</a> </blockquote> <a name="drop-view-stmt"></a> <h4>drop-view-stmt:</h4><blockquote> <img src="images/syntax/drop-view-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_dropview.html">lang_dropview.html</a> </blockquote> <a name="expr"></a> <h4>expr:</h4><blockquote> <img src="images/syntax/expr.gif"></img><br></br> Used by: <a href="#attach-stmt">attach-stmt</a> <a href="#column-constraint">column-constraint</a> <a href="#compound-select-stmt">compound-select-stmt</a> <a href="#create-index-stmt">create-index-stmt</a> <a href="#create-trigger-stmt">create-trigger-stmt</a> <a href="#delete-stmt">delete-stmt</a> <a href="#delete-stmt-limited">delete-stmt-limited</a> <a href="#factored-select-stmt">factored-select-stmt</a> <a href="#insert-stmt">insert-stmt</a> <a href="#join-constraint">join-constraint</a> <a href="#ordering-term">ordering-term</a> <a href="#result-column">result-column</a> <a href="#select-core">select-core</a> <a href="#select-stmt">select-stmt</a> <a href="#simple-select-stmt">simple-select-stmt</a> <a href="#table-constraint">table-constraint</a> <a href="#update-stmt">update-stmt</a> <a href="#update-stmt-limited">update-stmt-limited</a><br></br> References: <a href="#literal-value">literal-value</a> <a href="#raise-function">raise-function</a> <a href="#select-stmt">select-stmt</a> <a href="#type-name">type-name</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="raise-function"></a> <h4>raise-function:</h4><blockquote> <img src="images/syntax/raise-function.gif"></img><br></br> Used by: <a href="#expr">expr</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createtrigger.html#undef_before">lang_createtrigger.html#undef_before</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="literal-value"></a> <h4>literal-value:</h4><blockquote> <img src="images/syntax/literal-value.gif"></img><br></br> Used by: <a href="#column-constraint">column-constraint</a> <a href="#expr">expr</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="numeric-literal"></a> <h4>numeric-literal:</h4><blockquote> <img src="images/syntax/numeric-literal.gif"></img><br></br><br></br> See also: <a href="lang_expr.html#litvalue">lang_expr.html#litvalue</a> </blockquote> <a name="insert-stmt"></a> <h4>insert-stmt:</h4><blockquote> <img src="images/syntax/insert-stmt.gif"></img><br></br> Used by: <a href="#create-trigger-stmt">create-trigger-stmt</a> <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#expr">expr</a> <a href="#select-stmt">select-stmt</a> <a href="#with-clause">with-clause</a><br></br> See also: <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_insert.html">lang_insert.html</a> </blockquote> <a name="pragma-stmt"></a> <h4>pragma-stmt:</h4><blockquote> <img src="images/syntax/pragma-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#pragma-value">pragma-value</a><br></br> See also: <a href="pragma.html#syntax">pragma.html#syntax</a> </blockquote> <a name="pragma-value"></a> <h4>pragma-value:</h4><blockquote> <img src="images/syntax/pragma-value.gif"></img><br></br> Used by: <a href="#pragma-stmt">pragma-stmt</a><br></br> References: <a href="#signed-number">signed-number</a><br></br> See also: <a href="pragma.html#syntax">pragma.html#syntax</a> </blockquote> <a name="reindex-stmt"></a> <h4>reindex-stmt:</h4><blockquote> <img src="images/syntax/reindex-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_reindex.html">lang_reindex.html</a> </blockquote> <a name="select-stmt"></a> <h4>select-stmt:</h4><blockquote> <img src="images/syntax/select-stmt.gif"></img><br></br> Used by: <a href="#common-table-expression">common-table-expression</a> <a href="#create-table-stmt">create-table-stmt</a> <a href="#create-trigger-stmt">create-trigger-stmt</a> <a href="#create-view-stmt">create-view-stmt</a> <a href="#expr">expr</a> <a href="#insert-stmt">insert-stmt</a> <a href="#sql-stmt">sql-stmt</a> <a href="#table-or-subquery">table-or-subquery</a> <a href="#with-clause">with-clause</a><br></br> References: <a href="#common-table-expression">common-table-expression</a> <a href="#compound-operator">compound-operator</a> <a href="#expr">expr</a> <a href="#join-clause">join-clause</a> <a href="#ordering-term">ordering-term</a> <a href="#result-column">result-column</a> <a href="#table-or-subquery">table-or-subquery</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="lang_with.html#recursivecte">lang_with.html#recursivecte</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="join-clause"></a> <h4>join-clause:</h4><blockquote> <img src="images/syntax/join-clause.gif"></img><br></br> Used by: <a href="#select-core">select-core</a> <a href="#select-stmt">select-stmt</a> <a href="#table-or-subquery">table-or-subquery</a><br></br> References: <a href="#join-constraint">join-constraint</a> <a href="#join-operator">join-operator</a> <a href="#table-or-subquery">table-or-subquery</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="select-core"></a> <h4>select-core:</h4><blockquote> <img src="images/syntax/select-core.gif"></img><br></br> Used by: <a href="#compound-select-stmt">compound-select-stmt</a> <a href="#factored-select-stmt">factored-select-stmt</a> <a href="#simple-select-stmt">simple-select-stmt</a><br></br> References: <a href="#expr">expr</a> <a href="#join-clause">join-clause</a> <a href="#result-column">result-column</a> <a href="#table-or-subquery">table-or-subquery</a><br></br> See also: <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> </blockquote> <a name="factored-select-stmt"></a> <h4>factored-select-stmt:</h4><blockquote> <img src="images/syntax/factored-select-stmt.gif"></img><br></br><br></br> References: <a href="#common-table-expression">common-table-expression</a> <a href="#compound-operator">compound-operator</a> <a href="#expr">expr</a> <a href="#ordering-term">ordering-term</a> <a href="#select-core">select-core</a><br></br> See also: <a href="lang_select.html">lang_select.html</a> </blockquote> <a name="simple-select-stmt"></a> <h4>simple-select-stmt:</h4><blockquote> <img src="images/syntax/simple-select-stmt.gif"></img><br></br><br></br> References: <a href="#common-table-expression">common-table-expression</a> <a href="#expr">expr</a> <a href="#ordering-term">ordering-term</a> <a href="#select-core">select-core</a><br></br> See also: <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> </blockquote> <a name="compound-select-stmt"></a> <h4>compound-select-stmt:</h4><blockquote> <img src="images/syntax/compound-select-stmt.gif"></img><br></br><br></br> References: <a href="#common-table-expression">common-table-expression</a> <a href="#expr">expr</a> <a href="#ordering-term">ordering-term</a> <a href="#select-core">select-core</a><br></br> See also: <a href="lang_select.html#compound">lang_select.html#compound</a> </blockquote> <a name="table-or-subquery"></a> <h4>table-or-subquery:</h4><blockquote> <img src="images/syntax/table-or-subquery.gif"></img><br></br> Used by: <a href="#join-clause">join-clause</a> <a href="#select-core">select-core</a> <a href="#select-stmt">select-stmt</a><br></br> References: <a href="#join-clause">join-clause</a> <a href="#select-stmt">select-stmt</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="result-column"></a> <h4>result-column:</h4><blockquote> <img src="images/syntax/result-column.gif"></img><br></br> Used by: <a href="#select-core">select-core</a> <a href="#select-stmt">select-stmt</a><br></br> References: <a href="#expr">expr</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="join-operator"></a> <h4>join-operator:</h4><blockquote> <img src="images/syntax/join-operator.gif"></img><br></br> Used by: <a href="#join-clause">join-clause</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#fromclause">lang_select.html#fromclause</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="join-constraint"></a> <h4>join-constraint:</h4><blockquote> <img src="images/syntax/join-constraint.gif"></img><br></br> Used by: <a href="#join-clause">join-clause</a><br></br> References: <a href="#expr">expr</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#fromclause">lang_select.html#fromclause</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="ordering-term"></a> <h4>ordering-term:</h4><blockquote> <img src="images/syntax/ordering-term.gif"></img><br></br> Used by: <a href="#compound-select-stmt">compound-select-stmt</a> <a href="#delete-stmt-limited">delete-stmt-limited</a> <a href="#factored-select-stmt">factored-select-stmt</a> <a href="#select-stmt">select-stmt</a> <a href="#simple-select-stmt">simple-select-stmt</a> <a href="#update-stmt-limited">update-stmt-limited</a><br></br> References: <a href="#expr">expr</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="compound-operator"></a> <h4>compound-operator:</h4><blockquote> <img src="images/syntax/compound-operator.gif"></img><br></br> Used by: <a href="#factored-select-stmt">factored-select-stmt</a> <a href="#select-stmt">select-stmt</a><br></br> See also: <a href="lang_altertable.html">lang_altertable.html</a> <a href="lang_attach.html">lang_attach.html</a> <a href="lang_createindex.html">lang_createindex.html</a> <a href="lang_createtable.html">lang_createtable.html</a> <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_createview.html">lang_createview.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_expr.html">lang_expr.html</a> <a href="lang_insert.html">lang_insert.html</a> <a href="lang_select.html">lang_select.html</a> <a href="lang_select.html#compound">lang_select.html#compound</a> <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a> <a href="lang_update.html">lang_update.html</a> <a href="lang_with.html">lang_with.html</a> <a href="lang_with.html#recursivecte">lang_with.html#recursivecte</a> <a href="partialindex.html">partialindex.html</a> </blockquote> <a name="update-stmt"></a> <h4>update-stmt:</h4><blockquote> <img src="images/syntax/update-stmt.gif"></img><br></br> Used by: <a href="#create-trigger-stmt">create-trigger-stmt</a> <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#expr">expr</a> <a href="#qualified-table-name">qualified-table-name</a> <a href="#with-clause">with-clause</a><br></br> See also: <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_update.html">lang_update.html</a> </blockquote> <a name="update-stmt-limited"></a> <h4>update-stmt-limited:</h4><blockquote> <img src="images/syntax/update-stmt-limited.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> References: <a href="#expr">expr</a> <a href="#ordering-term">ordering-term</a> <a href="#qualified-table-name">qualified-table-name</a> <a href="#with-clause">with-clause</a><br></br> See also: <a href="lang_update.html">lang_update.html</a> </blockquote> <a name="qualified-table-name"></a> <h4>qualified-table-name:</h4><blockquote> <img src="images/syntax/qualified-table-name.gif"></img><br></br> Used by: <a href="#delete-stmt">delete-stmt</a> <a href="#delete-stmt-limited">delete-stmt-limited</a> <a href="#update-stmt">update-stmt</a> <a href="#update-stmt-limited">update-stmt-limited</a><br></br> See also: <a href="lang_createtrigger.html">lang_createtrigger.html</a> <a href="lang_delete.html">lang_delete.html</a> <a href="lang_indexedby.html">lang_indexedby.html</a> <a href="lang_update.html">lang_update.html</a> </blockquote> <a name="vacuum-stmt"></a> <h4>vacuum-stmt:</h4><blockquote> <img src="images/syntax/vacuum-stmt.gif"></img><br></br> Used by: <a href="#sql-stmt">sql-stmt</a><br></br> See also: <a href="lang_vacuum.html">lang_vacuum.html</a> </blockquote> <a name="comment-syntax"></a> <h4>comment-syntax:</h4><blockquote> <img src="images/syntax/comment-syntax.gif"></img><br></br><br></br> See also: <a href="lang_comment.html">lang_comment.html</a> </blockquote> |
Added Doc/Extra/Provider/lang_types.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | <html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" /> <title>TYPES</title> <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" /> </head> <body> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">TYPES</span> </td> </tr> <tr id="headerTableRow2"> <td align="left"> <span id="nsrTitle">SQLite Language Reference Documentation</span> </td> </tr> <tr id="headerTableRow3" style="display:none"> <td> <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a> <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a> </td> </tr> </table> <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none"> <tr> <td> <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0"> <img ID="toggleAllImage" class="toggleAll" src="collall.gif" /> <label id="collapseAllLabel" for="toggleAllImage" style="display: none;"> Collapse All </label> <label id="expandAllLabel" for="toggleAllImage" style="display: none;"> Expand All </label> </span> </td> </tr> </table> </div> <div id="mainSection"> <div id="mainBody"> <h1 class="heading"> SQL As Understood By SQLite (sortof)</h1> <h4> TYPES</h4> <p> <table cellpadding="10"> <tr> <td align="right" width="1%" nowrap> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">TYPES </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">...</font></i>] ; <em><span style="color: #ff3434">select-stmt</span></em></td> </tr> <tr> <td align="right" width="1%" nowrap> <i><font color="#ff3434">select-stmt</font></i> ::=</td> <td> see <a href="lang_select.html">SELECT</a></td> </tr> </table> </p> <p> Use the TYPES keyword before a SELECT statement to provide the SQLite ADO.NET provider a list of return datatypes to expect from the subsequent SELECT statement. </p> <p> This is a language extension (aka <strong>hack</strong>) to SQLite specifically for the ADO.NET data provider. It is a pseudo-statement, meaning only the ADO.NET provider understands it.</p> <h3> Background</h3> <p> Due to SQLite's typeless nature, there are certain kinds of queries for which the ADO.NET provider cannot determine the proper return data type. Scalar and aggregate functions pose a particular problem because there is no requirement for a given scalar or aggregate function to return any particular datatype. As a matter of fact, scalar functions could theoretically return a different datatype for every row or column in a query and this is perfectly legal from SQLite's point of view.</p> <p> Since ADO.NET is designed around a typed system and we're shoe-horning SQLite into it, this keyword helps the provider out in cases where the return type cannot be easily determined.</p> <p> This command must be used in conjunction with a SELECT statement. It only works when both the TYPES keyword and its value(s) are passed along with a SELECT statement as a single semi-colon separated unit.</p> <h3> Examples</h3> <p> <strong><span style="color: #2c2cf0">TYPES</span> [bigint], [int], [smallint], [tinyint];<br /> <span style="color: #2c2cf0">SELECT</span> 1, 2, 3, 4;</strong></p> <p> The above query would return the columns as types System.Int64, System.Int32, System.Int16 and System.Byte respectively.</p> <p> <strong><span style="color: #2c2cf0">TYPES</span> [bigint], [int], , [tinyint];<br /> <span style="color: #2c2cf0">SELECT</span> 1, 2, 3, 4;</strong></p> <p> In this sample, only columns 1, 2 and 4 would have explicit typing. Column 3's datatype would pass though the system and be discovered normally.</p> <p> <strong><span style="color: #2c2cf0">TYPES</span> real;<br /> <span style="color: #2c2cf0">SELECT</span> SUM(Cost) FROM [Products];</strong></p> <p> The above query explicitly tells the provider that the SUM aggregate function returns a System.Double.</p> <h3> Usage Notes</h3> <ul> <li>You cannot use parameters in the TYPES statement.</li> <li>The TYPES statement must be immediately followed by a SELECT statement.</li> <li>It is legal to pass multiple TYPES and SELECT statements in a multi-statement command.</li> <li>You may enclose datatypes in quotes <strong>""</strong> or brackets <strong>[]</strong> or those <strong>``</strong> thingies if you want.<br /> </li> </ul> <hr> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/Provider/syntax.html.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | <html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" /> <title>SQLite Query Syntax</title> <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" /> </head> <body> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">SQLite Query Syntax</span> </td> </tr> <tr id="headerTableRow2"> <td align="left"> <span id="nsrTitle">SQLite Language Reference Documentation</span> </td> </tr> <tr id="headerTableRow3" style="display:none"> <td> <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a> <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a> </td> </tr> </table> <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none"> <tr> <td> <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0"> <img ID="toggleAllImage" class="toggleAll" src="collall.gif" /> <label id="collapseAllLabel" for="toggleAllImage" style="display: none;"> Collapse All </label> <label id="expandAllLabel" for="toggleAllImage" style="display: none;"> Expand All </label> </span> </td> </tr> </table> </div> <div id="mainSection"> <div id="mainBody"> <h1 class="heading"> SQL As Understood By System.Data.SQLite</h1> <p> The SQLite library understands most of the standard SQL language. But it does omit some features while at the same time adding a few features of its own. This document attempts to describe precisely what parts of the SQL language SQLite does and does not support. A list of keywords is also provided. In all of the syntax diagrams that follow, literal text is shown in bold blue. Non-terminal symbols are shown in italic red. Operators that are part of the syntactic markup itself are shown in black roman. This document is just an overview of the SQL syntax implemented by SQLite. </p> <h4> The SQLite core library implements the follow syntax:</h4> <p> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"> <tr> <td> <a href="../Core/lang.html"> SQL As Understood By SQLite</a></td> </tr> </table> </p> <h4> The System.Data.SQLite provider implements the follow additional syntax:</h4> <p> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"> <tr> <td> <a href="lang_types.html"> TYPES</a></td> </tr> </table> </p> <hr> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Changes to Doc/Extra/Provider/version.html.
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | </div> <div id="mainSection"> <div id="mainBody"> <h1 class="heading">Version History</h1> <p><b>1.0.91.0 - February XX, 2014 <font color="red">(release scheduled)</font></b></p> <ul> <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_3.html">SQLite 3.8.3</a>.</li> <li>Add support for <a href="http://entityframework.codeplex.com/">Entity Framework 6</a>.</li> <li>Add support for per-connection mappings between type names and DbType values. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/e87af1d06a">[e87af1d06a]</a>.</li> <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly. <b>** Potentially Incompatible Change **</b></li> <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li> <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li> <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li> <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/a47eff2c71">[a47eff2c71]</a>.</li> | > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | </div> <div id="mainSection"> <div id="mainBody"> <h1 class="heading">Version History</h1> <p><b>1.0.91.0 - February XX, 2014 <font color="red">(release scheduled)</font></b></p> <ul> <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_3.html">SQLite 3.8.3</a>.</li> <li>Refresh all included SQLite core library documentation (e.g. SQL syntax).</li> <li>Add support for <a href="http://entityframework.codeplex.com/">Entity Framework 6</a>.</li> <li>Add support for per-connection mappings between type names and DbType values. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/e87af1d06a">[e87af1d06a]</a>.</li> <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly. <b>** Potentially Incompatible Change **</b></li> <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li> <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li> <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li> <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/a47eff2c71">[a47eff2c71]</a>.</li> |
︙ | ︙ |
Changes to Doc/SQLite.NET.hhc.
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 | <param name="Name" value="Optimizing SQL Queries"> <param name="Local" value="Provider/optimizing.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Provider Limitations"> <param name="Local" value="Provider/limitations.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Version History"> <param name="Local" value="Provider/version.html"> </OBJECT> </UL> <LI> <OBJECT type="text/sitemap"> | > > > > > > > > | | > > > > | < < < < | | > > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <param name="Name" value="Optimizing SQL Queries"> <param name="Local" value="Provider/optimizing.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Provider Limitations"> <param name="Local" value="Provider/limitations.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Syntax Reference"> <param name="Local" value="Provider/syntax.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="TYPES"> <param name="Local" value="Provider/lang_types.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Version History"> <param name="Local" value="Provider/version.html"> </OBJECT> </UL> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Query Language Understood by SQLite"> <param name="Local" value="Core/lang.html"> </OBJECT> <UL> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Aggregate Functions"> <param name="Local" value="Core/lang_aggfunc.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="ALTER TABLE"> <param name="Local" value="Core/lang_altertable.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="ANALYZE"> <param name="Local" value="Core/lang_analyze.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="ATTACH DATABASE"> <param name="Local" value="Core/lang_attach.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Comments"> <param name="Local" value="Core/lang_comment.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="ON CONFLICT"> <param name="Local" value="Core/lang_conflict.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Core Functions"> <param name="Local" value="Core/lang_corefunc.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="CREATE INDEX"> <param name="Local" value="Core/lang_createindex.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="CREATE TABLE"> |
︙ | ︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 92 93 | <param name="Name" value="CREATE VIEW"> <param name="Local" value="Core/lang_createview.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="CREATE VIRTUAL TABLE"> <param name="Local" value="Core/lang_createvtab.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="DELETE"> <param name="Local" value="Core/lang_delete.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="DETACH DATABASE"> <param name="Local" value="Core/lang_detach.html"> | > > > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | <param name="Name" value="CREATE VIEW"> <param name="Local" value="Core/lang_createview.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="CREATE VIRTUAL TABLE"> <param name="Local" value="Core/lang_createvtab.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Date And Time Functions"> <param name="Local" value="Core/lang_datefunc.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="DELETE"> <param name="Local" value="Core/lang_delete.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="DETACH DATABASE"> <param name="Local" value="Core/lang_detach.html"> |
︙ | ︙ | |||
104 105 106 107 108 109 110 | <param name="Name" value="DROP TRIGGER"> <param name="Local" value="Core/lang_droptrigger.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="DROP VIEW"> <param name="Local" value="Core/lang_dropview.html"> </OBJECT> | < < < < | > > > > | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | <param name="Name" value="DROP TRIGGER"> <param name="Local" value="Core/lang_droptrigger.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="DROP VIEW"> <param name="Local" value="Core/lang_dropview.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="EXPLAIN"> <param name="Local" value="Core/lang_explain.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Expressions"> <param name="Local" value="Core/lang_expr.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="INDEXED BY"> <param name="Local" value="Core/lang_indexedby.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="INSERT"> <param name="Local" value="Core/lang_insert.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Keywords"> <param name="Local" value="Core/lang_keywords.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Database Object Name Resolution"> <param name="Local" value="Core/lang_naming.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="REINDEX"> <param name="Local" value="Core/lang_reindex.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="REPLACE"> <param name="Local" value="Core/lang_replace.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="SAVEPOINT"> <param name="Local" value="Core/lang_savepoint.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="SELECT"> <param name="Local" value="Core/lang_select.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="BEGIN TRANSACTION"> <param name="Local" value="Core/lang_transaction.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="COMMIT TRANSACTION"> <param name="Local" value="Core/lang_transaction.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="END TRANSACTION"> <param name="Local" value="Core/lang_transaction.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="ROLLBACK TRANSACTION"> <param name="Local" value="Core/lang_transaction.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="UPDATE"> <param name="Local" value="Core/lang_update.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="VACUUM"> <param name="Local" value="Core/lang_vacuum.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="WITH"> <param name="Local" value="Core/lang_with.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="PRAGMA"> <param name="Local" value="Core/pragma.html"> </OBJECT> <LI> <OBJECT type="text/sitemap"> <param name="Name" value="Syntax Diagrams"> <param name="Local" value="Core/syntaxdiagrams.html"> </OBJECT> </UL> </BODY><HTML> |
Changes to Doc/SQLite.NET.hhp.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | [OPTIONS] Compatibility=1.1 or later Compiled file=SQLite.NET.extra.chm Contents file=SQLite.NET.hhc Default topic=Provider\welcome.html Display compile progress=Yes Error log file=SQLite.NET.log Full-text search=Yes Language=0x409 English (United States) Title=SQLite.NET Help [FILES] Core\lang_altertable.html Core\lang_analyze.html Core\lang_attach.html Core\lang_comment.html Core\lang_conflict.html Core\lang_createindex.html Core\lang_createtable.html Core\lang_createtrigger.html Core\lang_createview.html Core\lang_createvtab.html | > > > | > > > > < > | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | [OPTIONS] Compatibility=1.1 or later Compiled file=SQLite.NET.extra.chm Contents file=SQLite.NET.hhc Default topic=Provider\welcome.html Display compile progress=Yes Error log file=SQLite.NET.log Full-text search=Yes Language=0x409 English (United States) Title=SQLite.NET Help [FILES] Core\lang.html Core\lang_aggfunc.html Core\lang_altertable.html Core\lang_analyze.html Core\lang_attach.html Core\lang_comment.html Core\lang_conflict.html Core\lang_corefunc.html Core\lang_createindex.html Core\lang_createtable.html Core\lang_createtrigger.html Core\lang_createview.html Core\lang_createvtab.html Core\lang_datefunc.html Core\lang_delete.html Core\lang_detach.html Core\lang_dropindex.html Core\lang_droptable.html Core\lang_droptrigger.html Core\lang_dropview.html Core\lang_explain.html Core\lang_expr.html Core\lang_indexedby.html Core\lang_insert.html Core\lang_keywords.html Core\lang_naming.html Core\lang_reindex.html Core\lang_replace.html Core\lang_savepoint.html Core\lang_select.html Core\lang_transaction.html Core\lang_update.html Core\lang_vacuum.html Core\lang_with.html Core\pragma.html Core\syntaxdiagrams.html Include\ndoc.css Provider\dbfactorysupport.html Provider\designer.html Provider\environment.html Provider\lang_types.html Provider\limitations.html Provider\optimizing.html Provider\syntax.html Provider\version.html Provider\welcome.html |
Changes to Doc/buildChm.tcl.
︙ | ︙ | |||
22 23 24 25 26 27 28 | set file_id [open $fileName {WRONLY CREAT TRUNC}] fconfigure $file_id -encoding binary -translation binary puts -nonewline $file_id $data close $file_id return "" } | | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | set file_id [open $fileName {WRONLY CREAT TRUNC}] fconfigure $file_id -encoding binary -translation binary puts -nonewline $file_id $data close $file_id return "" } proc escapeSubSpec { data } { regsub -all -- {&} $data {\\\&} data regsub -all -- {\\(\d+)} $data {\\\\\1} data return $data } proc readFileAsSubSpec { fileName } { return [escapeSubSpec [readFile $fileName]] } proc getFileHash { fileName } { if {[catch { exec fossil.exe sha1sum [file nativename $fileName] } result] == 0} then { return [string trim [lindex [split $result " "] 0]] } return "" } # # HACK: This procedure checks all the "href" attribute values in the specified # core documentation file. For each value, this procedure checks if the # reference conforms to one of the following general categories: # # 1. A relative reference to a named anchor within the same document. # 2. An absolute reference using HTTP or HTTPS. # 3. A relative reference to an existing local file. # 4. An absolute reference to a local file. # # Otherwise, this procedure transforms the "href" attribute value into # an absolute reference using the specified base URL. # proc transformCoreDocumentationFile { fileName url } { # # NOTE: Grab the name of the directory containing the file. # set directory [file dirname $fileName] # # NOTE: Read all the textual data from the file. # set data [readFile $fileName] # # NOTE: No replacements made yet. # set count 0 # # NOTE: Process all "href" attribute values from the data. This pattern is # not univeral; however, as of this writing (Feb 2014), the core docs # are using it consistently. # foreach {dummy href} [regexp -all -inline -nocase -- {href="(.*?)"} $data] { # # NOTE: Skip all references to other items on this page. # if {[string index $href 0] eq "#"} then { continue } # # NOTE: Skip all absolute HTTP/HTTPS references. # if {[string range $href 0 6] eq "http://" || \ [string range $href 0 7] eq "https://"} then { continue } # # NOTE: Split on the "#" character to get the file name. There are some # places within the core docs that refer to named anchors within # other files. # set parts [split $href #]; set part1 [lindex $parts 0] # # NOTE: If there is no file name part, skip the reference. # if {[string length $part1] == 0} then { continue } # # NOTE: If it does not appear to be relative, skip it. # if {[file pathtype $part1] ne "relative"} then { continue } # # NOTE: If the referenced file name exists locally, skip it. # if {[file exists [file join $directory $part1]]} then { continue } # # NOTE: Replace the reference with an absolute reference using the base # URL specified by the caller, escaping it as necessary for use # with [regsub]. # set pattern "***=$dummy"; # NOTE: Use literal string syntax. set subSpec "href=\"[escapeSubSpec $url$href]\"" # # NOTE: Perform the replacements, if any, keeping track of how many were # done. # incr count [regsub -all -- $pattern $data $subSpec data] } # # NOTE: If some replacements were performed on the data from the file, then # overwrite it with the new data; otherwise, issue a warning. # if {$count > 0} then { writeFile $fileName $data } else { puts stdout "*WARNING* File \"$fileName\" does not match: href=\"(.*?)\"" } } # # HACK: Copy our local [fixed] copy of the MSDN documenter assembly into the # installed location of NDoc3, if necessary. Actually copying the file # will require elevated administrator privileges; otherwise, it will # fail. Any errors encountered while copying the file are reported via # the console; however, they will not halt further processing (i.e. the |
︙ | ︙ | |||
77 78 79 80 81 82 83 84 85 86 87 88 89 90 | } } else { puts stdout \ "skipped copying \"$sourceFileName\" to \"$destinationFileName\"" } } set path [file normalize [file dirname [info script]]] set nDocExtPath [file join [file dirname $path] Externals NDoc3] set nDocInstPath [file join $env(ProgramFiles) NDoc3] if {![file isdirectory $nDocInstPath]} then { puts stdout "NDoc3 must be installed to: $nDocInstPath" | > > > | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | } } else { puts stdout \ "skipped copying \"$sourceFileName\" to \"$destinationFileName\"" } } # # NOTE: This is the entry point for this script. # set path [file normalize [file dirname [info script]]] set nDocExtPath [file join [file dirname $path] Externals NDoc3] set nDocInstPath [file join $env(ProgramFiles) NDoc3] if {![file isdirectory $nDocInstPath]} then { puts stdout "NDoc3 must be installed to: $nDocInstPath" |
︙ | ︙ | |||
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | # # TODO: If the NDoc version number ever changes, the next line of code will # probably need to be updated. # set outputPath [file join Output] set temporaryPath [file join $outputPath ndoc3_msdn_temp] if {[file isdirectory $nDocExtPath]} then { copyMsdnDocumenter $nDocExtPath $nDocInstPath } set code [catch {exec [file join $nDocInstPath bin NDoc3Console.exe] \ "-project=[file nativename $projectFile]"} result] puts stdout $result; if {$code != 0} then {exit $code} | > > < > | > | > > > | > > > > > | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | # # TODO: If the NDoc version number ever changes, the next line of code will # probably need to be updated. # set outputPath [file join Output] set temporaryPath [file join $outputPath ndoc3_msdn_temp] set corePath [file join $temporaryPath Core] set providerPath [file join $temporaryPath Provider] if {[file isdirectory $nDocExtPath]} then { copyMsdnDocumenter $nDocExtPath $nDocInstPath } set code [catch {exec [file join $nDocInstPath bin NDoc3Console.exe] \ "-project=[file nativename $projectFile]"} result] puts stdout $result; if {$code != 0} then {exit $code} ############################################################################### foreach fileName [glob -nocomplain [file join $corePath *.html]] { set fileName [file join $path $fileName] if {![file isfile $fileName]} then { puts stdout "Cannot find core file: $fileName" exit 1 } transformCoreDocumentationFile $fileName http://www.sqlite.org/ } ############################################################################### set patterns(.hhc,1) {<!--This document contains Table of Contents information\ for the HtmlHelp compiler\.--><UL>} set patterns(.hhp,1) {Default topic=~System\.Data\.SQLite\.html} set patterns(.hhp,2) \ |
︙ | ︙ | |||
203 204 205 206 207 208 209 | set subSpecs(.html,3) {78dfe2yb} set subSpecs(.html,4) {"\1~Overloads.html"} set subSpecs(.html,5) {"\1~Overloads.html"} set subSpecs(.html,6) {"\1~Overloads.html"} set subSpecs(.html,7) {"\1~Overloads.html"} set subSpecs(.html,8) {"\1~Overloads.html"} | > > > > > > > > > > | | | | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | set subSpecs(.html,3) {78dfe2yb} set subSpecs(.html,4) {"\1~Overloads.html"} set subSpecs(.html,5) {"\1~Overloads.html"} set subSpecs(.html,6) {"\1~Overloads.html"} set subSpecs(.html,7) {"\1~Overloads.html"} set subSpecs(.html,8) {"\1~Overloads.html"} ############################################################################### set providerFileNames [list \ [file join $temporaryPath SQLite.NET.hhp] \ [file join $temporaryPath SQLite.NET.hhc]] foreach fileName [glob -nocomplain [file join $providerPath *.html]] { lappend providerFileNames $fileName } foreach fileName $providerFileNames { set fileName [file join $path $fileName] # # NOTE: Make sure the file we need actually exists. # if {![file isfile $fileName]} then { puts stdout "Cannot find provider file: $fileName" exit 1 } # # NOTE: Read the entire file into memory. # set data [readFile $fileName] |
︙ | ︙ |
Changes to Setup/verify.lst.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # source code archive. # set sds_manifests(source) { Doc/ Doc/buildChm.tcl Doc/Extra/ Doc/Extra/Core/ Doc/Extra/Core/lang_altertable.html Doc/Extra/Core/lang_analyze.html Doc/Extra/Core/lang_attach.html Doc/Extra/Core/lang_comment.html Doc/Extra/Core/lang_conflict.html Doc/Extra/Core/lang_createindex.html Doc/Extra/Core/lang_createtable.html Doc/Extra/Core/lang_createtrigger.html Doc/Extra/Core/lang_createview.html Doc/Extra/Core/lang_createvtab.html | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | | | > | > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | # source code archive. # set sds_manifests(source) { Doc/ Doc/buildChm.tcl Doc/Extra/ Doc/Extra/Core/ Doc/Extra/Core/images/ Doc/Extra/Core/images/sqlite370_banner.gif Doc/Extra/Core/images/syntax/ Doc/Extra/Core/images/syntax/a.gif Doc/Extra/Core/images/syntax/alter-table-stmt.gif Doc/Extra/Core/images/syntax/analyze-stmt.gif Doc/Extra/Core/images/syntax/attach-stmt.gif Doc/Extra/Core/images/syntax/begin-stmt.gif Doc/Extra/Core/images/syntax/column-constraint.gif Doc/Extra/Core/images/syntax/column-def.gif Doc/Extra/Core/images/syntax/comment-syntax.gif Doc/Extra/Core/images/syntax/commit-stmt.gif Doc/Extra/Core/images/syntax/common-table-expression.gif Doc/Extra/Core/images/syntax/compound-operator.gif Doc/Extra/Core/images/syntax/compound-select-stmt.gif Doc/Extra/Core/images/syntax/conflict-clause.gif Doc/Extra/Core/images/syntax/create-index-stmt.gif Doc/Extra/Core/images/syntax/create-table-stmt.gif Doc/Extra/Core/images/syntax/create-trigger-stmt.gif Doc/Extra/Core/images/syntax/create-view-stmt.gif Doc/Extra/Core/images/syntax/create-virtual-table-stmt.gif Doc/Extra/Core/images/syntax/cte-table-name.gif Doc/Extra/Core/images/syntax/delete-stmt-limited.gif Doc/Extra/Core/images/syntax/delete-stmt.gif Doc/Extra/Core/images/syntax/detach-stmt.gif Doc/Extra/Core/images/syntax/drop-index-stmt.gif Doc/Extra/Core/images/syntax/drop-table-stmt.gif Doc/Extra/Core/images/syntax/drop-trigger-stmt.gif Doc/Extra/Core/images/syntax/drop-view-stmt.gif Doc/Extra/Core/images/syntax/expr.gif Doc/Extra/Core/images/syntax/factored-select-stmt.gif Doc/Extra/Core/images/syntax/floating-point-literal.gif Doc/Extra/Core/images/syntax/foreign-key-clause.gif Doc/Extra/Core/images/syntax/foreign-key-clause2.gif Doc/Extra/Core/images/syntax/indexed-column.gif Doc/Extra/Core/images/syntax/insert-stmt.gif Doc/Extra/Core/images/syntax/join-clause.gif Doc/Extra/Core/images/syntax/join-constraint.gif Doc/Extra/Core/images/syntax/join-op.gif Doc/Extra/Core/images/syntax/join-operator.gif Doc/Extra/Core/images/syntax/join-source.gif Doc/Extra/Core/images/syntax/literal-value.gif Doc/Extra/Core/images/syntax/numeric-literal.gif Doc/Extra/Core/images/syntax/ordering-term.gif Doc/Extra/Core/images/syntax/pragma-stmt.gif Doc/Extra/Core/images/syntax/pragma-value.gif Doc/Extra/Core/images/syntax/qualified-table-name.gif Doc/Extra/Core/images/syntax/raise-function.gif Doc/Extra/Core/images/syntax/recursive-cte.gif Doc/Extra/Core/images/syntax/reindex-stmt.gif Doc/Extra/Core/images/syntax/release-stmt.gif Doc/Extra/Core/images/syntax/result-column.gif Doc/Extra/Core/images/syntax/rollback-stmt.gif Doc/Extra/Core/images/syntax/savepoint-stmt.gif Doc/Extra/Core/images/syntax/select-core.gif Doc/Extra/Core/images/syntax/select-stmt.gif Doc/Extra/Core/images/syntax/signed-number.gif Doc/Extra/Core/images/syntax/simple-select-stmt.gif Doc/Extra/Core/images/syntax/single-source.gif Doc/Extra/Core/images/syntax/sql-stmt-list.gif Doc/Extra/Core/images/syntax/sql-stmt.gif Doc/Extra/Core/images/syntax/table-constraint.gif Doc/Extra/Core/images/syntax/table-or-subquery.gif Doc/Extra/Core/images/syntax/type-name.gif Doc/Extra/Core/images/syntax/update-stmt-limited.gif Doc/Extra/Core/images/syntax/update-stmt.gif Doc/Extra/Core/images/syntax/vacuum-stmt.gif Doc/Extra/Core/images/syntax/with-clause.gif Doc/Extra/Core/lang.html Doc/Extra/Core/lang_aggfunc.html Doc/Extra/Core/lang_altertable.html Doc/Extra/Core/lang_analyze.html Doc/Extra/Core/lang_attach.html Doc/Extra/Core/lang_comment.html Doc/Extra/Core/lang_conflict.html Doc/Extra/Core/lang_corefunc.html Doc/Extra/Core/lang_createindex.html Doc/Extra/Core/lang_createtable.html Doc/Extra/Core/lang_createtrigger.html Doc/Extra/Core/lang_createview.html Doc/Extra/Core/lang_createvtab.html Doc/Extra/Core/lang_datefunc.html Doc/Extra/Core/lang_delete.html Doc/Extra/Core/lang_detach.html Doc/Extra/Core/lang_dropindex.html Doc/Extra/Core/lang_droptable.html Doc/Extra/Core/lang_droptrigger.html Doc/Extra/Core/lang_dropview.html Doc/Extra/Core/lang_explain.html Doc/Extra/Core/lang_expr.html Doc/Extra/Core/lang_indexedby.html Doc/Extra/Core/lang_insert.html Doc/Extra/Core/lang_keywords.html Doc/Extra/Core/lang_naming.html Doc/Extra/Core/lang_reindex.html Doc/Extra/Core/lang_replace.html Doc/Extra/Core/lang_savepoint.html Doc/Extra/Core/lang_select.html Doc/Extra/Core/lang_transaction.html Doc/Extra/Core/lang_update.html Doc/Extra/Core/lang_vacuum.html Doc/Extra/Core/lang_with.html Doc/Extra/Core/pragma.html Doc/Extra/Core/syntaxdiagrams.html Doc/Extra/Include/ Doc/Extra/Include/ndoc.css Doc/Extra/Provider/ Doc/Extra/Provider/dbfactorysupport.html Doc/Extra/Provider/designer.html Doc/Extra/Provider/environment.html Doc/Extra/Provider/lang_types.html Doc/Extra/Provider/limitations.html Doc/Extra/Provider/optimizing.html Doc/Extra/Provider/syntax.html Doc/Extra/Provider/version.html Doc/Extra/Provider/welcome.html Doc/SQLite.NET.chm Doc/SQLite.NET.hhc Doc/SQLite.NET.hhp Doc/SQLite.NET.ndoc exclude_bin.txt |
︙ | ︙ |
Changes to readme.htm.
︙ | ︙ | |||
209 210 211 212 213 214 215 216 217 218 219 220 221 222 | <h2><b>Version History</b></h2> <p> <b>1.0.91.0 - February XX, 2014 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_3.html">SQLite 3.8.3</a>.</li> <li>Add support for <a href="http://entityframework.codeplex.com/">Entity Framework 6</a>.</li> <li>Add support for per-connection mappings between type names and DbType values. Pursuant to [e87af1d06a].</li> <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly. <b>** Potentially Incompatible Change **</b></li> <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li> <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li> <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li> <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to [a47eff2c71].</li> | > | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | <h2><b>Version History</b></h2> <p> <b>1.0.91.0 - February XX, 2014 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_3.html">SQLite 3.8.3</a>.</li> <li>Refresh all included SQLite core library documentation (e.g. SQL syntax).</li> <li>Add support for <a href="http://entityframework.codeplex.com/">Entity Framework 6</a>.</li> <li>Add support for per-connection mappings between type names and DbType values. Pursuant to [e87af1d06a].</li> <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly. <b>** Potentially Incompatible Change **</b></li> <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li> <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li> <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li> <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to [a47eff2c71].</li> |
︙ | ︙ |
Changes to www/news.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <title>News</title> <b>Version History</b> <p> <b>1.0.91.0 - February XX, 2014 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to [http://www.sqlite.org/releaselog/3_8_3.html|SQLite 3.8.3].</li> <li>Add support for [http://entityframework.codeplex.com/|Entity Framework 6].</li> <li>Add support for per-connection mappings between type names and DbType values. Pursuant to [e87af1d06a].</li> <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly. <b>** Potentially Incompatible Change **</b></li> <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li> <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li> <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li> <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to [a47eff2c71].</li> | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <title>News</title> <b>Version History</b> <p> <b>1.0.91.0 - February XX, 2014 <font color="red">(release scheduled)</font></b> </p> <ul> <li>Updated to [http://www.sqlite.org/releaselog/3_8_3.html|SQLite 3.8.3].</li> <li>Refresh all included SQLite core library documentation (e.g. SQL syntax).</li> <li>Add support for [http://entityframework.codeplex.com/|Entity Framework 6].</li> <li>Add support for per-connection mappings between type names and DbType values. Pursuant to [e87af1d06a].</li> <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly. <b>** Potentially Incompatible Change **</b></li> <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li> <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li> <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li> <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to [a47eff2c71].</li> |
︙ | ︙ |