Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Additional docs |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sourceforge |
Files: | files | file ages | folders |
SHA1: |
61e01b2074ef6e1b4b12a7c6a3504586 |
User & Date: | rmsimpson 2006-09-08 21:31:46.000 |
Context
2006-09-09
| ||
15:28 | 1.0.34.0 check-in: c57b635c6b user: rmsimpson tags: sourceforge | |
2006-09-08
| ||
21:31 | Additional docs check-in: 61e01b2074 user: rmsimpson tags: sourceforge | |
20:18 | 1.0.35.0 check-in: 76248530ca user: rmsimpson tags: sourceforge | |
Changes
Added Doc/Extra/blank.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 | <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>[Title Goes Here]</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">[Running Header]</span> </td> </tr> <tr id="headerTableRow2"> <td align="left"> <span id="nsrTitle">[Header Row]</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">[H1 Header]</h1> <p> [Document Text] </p> <h4> [Sub Section]</h4> <p> [Sub Section Text] </p> <hr> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>ALTER TABLE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">ALTER TABLE</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</h1> <h4> ALTER TABLE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">ALTER TABLE </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">alteration</font></i><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">alteration</font></i> ::=</td> <td> <b><font color="#2c2cf0">RENAME TO </font></b><i><font color="#ff3434">new-table-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">alteration</font></i> ::=</td> <td> <b><font color="#2c2cf0">ADD </font></b>[<b><font color="#2c2cf0">COLUMN</font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">column-def</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> SQLite's version of the ALTER TABLE command allows the user to rename or add a new column to an existing table. It is not possible to remove a column from a 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> 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. <i>Column-def</i> may take any of the forms permissable in a CREATE TABLE statement, with the following restrictions: </p> <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 or CURRENT_TIMESTAMP. </li> <li>If a NOT NULL constraint is specified, then the column must have a default value other than NULL. </li> </ul> <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 until the database is <a href="lang_vacuum.html"> VACUUM</a>ed.</p> <p> </p> <hr> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>ANALYZE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">ANALYZE</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</h1> <h4> ANALYZE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">ANALYZE</font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">ANALYZE </font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">ANALYZE </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The ANALYZE command gathers statistics about indices and stores them in a special tables in the database where the query optimizer can use them to help make better index choices. If no arguments are given, all indices in all attached databases are analyzed. If a database name is given as the argument, all indices in that one database are analyzed. If the argument is a table name, then only indices associated with that one table are analyzed.</p> <p> The initial implementation stores all statistics in a single table named <b>sqlite_stat1</b>. Future enhancements may create additional tables with the same name pattern except with the "1" changed to a different digit. The <b>sqlite_stat1</b> table cannot be <a href="lang_droptable.html">DROP</a>ped, but all the content can be <a href="lang_delete.html"> DELETE</a>d which has the same effect.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>ATTACH DATABASE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">ATTACH DATABASE</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</h1> <h4> ATTACH DATABASE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">ATTACH </font></b>[<b><font color="#2c2cf0">DATABASE</font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">database-filename</font></i><b><font color="#2c2cf0"> AS </font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The ATTACH DATABASE statement adds another database file to the current database connection. If the filename contains punctuation characters it must be quoted. The names 'main' and 'temp' refer to the main database and the database used for temporary tables. These cannot be detached. Attached databases are removed using the <a href="lang_detach.html"> DETACH DATABASE</a> statement.</p> <p> You can read from and write to an attached database and you can modify the schema of the attached database. This is a new feature of SQLite version 3.0. In SQLite 2.8, schema changes to attached databases were not allowed.</p> <p> You cannot create a new table with the same name as a table in an attached database, but you can attach a database which contains tables whose names are duplicates of tables in the main database. It is also permissible to attach the same database file multiple times.</p> <p> Tables in an attached database can be referred to using the syntax <i>database-name.table-name</i>. If an attached table doesn't have a duplicate table name in the main database, it doesn't require a database name prefix. When a database is attached, all of its tables which don't have duplicate names become the default table of that name. Any tables of that name attached afterwards require the table prefix. If the default table of a given name is detached, then the last table of that name attached becomes the new default.</p> <p> Transactions involving multiple attached databases are atomic, assuming that the main database is not ":memory:". If the main database is ":memory:" then transactions continue to be atomic within each individual database file. But if the host computer crashes in the middle of a COMMIT where two or more database files are updated, some of those files might get the changes where others might not. Atomic commit of attached databases is a new feature of SQLite version 3.0. In SQLite version 2.8, all commits to attached databases behaved as if the main database were ":memory:". </p> <p> There is a compile-time limit of 10 attached database files.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>comment</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">comment</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</h1> <h4> comment</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">comment</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">SQL-comment</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">C-comment</font></i><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">SQL-comment</font></i> ::=</td> <td> <b><font color="#2c2cf0">-- </font></b><i><font color="#ff3434">single-line</font></i><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">C-comment</font></i> ::=</td> <td> <b><font color="#2c2cf0">/<big>*</big> </font></b><i><font color="#ff3434">multiple-lines</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>*</big>/</font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> Comments aren't SQL commands, but can occur in SQL queries. They are treated as whitespace by the parser. They can begin anywhere whitespace can be found, including inside expressions that span multiple lines. </p> <p> SQL comments only extend to the end of the current line.</p> <p> C comments can span any number of lines. If there is no terminating delimiter, they extend to the end of the input. This is not treated as an error. A new SQL statement can begin on a line after a multiline comment ends. C comments can be embedded anywhere whitespace can occur, including inside expressions, and in the middle of other SQL statements. C comments do not nest. SQL comments inside a C comment will be ignored. </p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>ON CONFLICT</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">ON CONFLICT clause</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</h1> <h4> ON CONFLICT clause</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">conflict-clause</font></i> ::=</td> <td> <b><font color="#2c2cf0">ON CONFLICT </font></b><i><font color="#ff3434">conflict-algorithm</font></i><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">conflict-algorithm</font></i> ::=</td> <td> <b><font color="#2c2cf0">ROLLBACK </font></b><big>|</big><b><font color="#2c2cf0"> ABORT </font></b><big>|</big><b><font color="#2c2cf0"> FAIL </font></b><big>|</big><b><font color="#2c2cf0"> IGNORE </font></b><big>|</big><b><font color="#2c2cf0"> REPLACE</font></b></td> </tr> </table> </p> <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", to make the syntax seem more natural. 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 specifies an algorithm used to resolve constraint conflicts. There are five choices: ROLLBACK, ABORT, FAIL, IGNORE, and REPLACE. The default algorithm is ABORT. This is what they mean:</p> <dl> <dt><b>ROLLBACK</b> </dt> <dd> <p> When a constraint violation occurs, an immediate ROLLBACK occurs, thus ending the current transaction, and the command aborts with a return code of SQLITE_CONSTRAINT. If no transaction is active (other than the implied transaction that is created on every command) then this algorithm works the same as ABORT.</p> </dd> <dt><b>ABORT</b> </dt> <dd> <p> When a constraint violation occurs, the command backs out any prior changes it might have made and aborts with a return code of SQLITE_CONSTRAINT. But no ROLLBACK is executed so changes from prior commands within the same transaction are preserved. This is the default behavior.</p> </dd> <dt><b>FAIL</b> </dt> <dd> <p> When a constraint violation occurs, the command aborts with a return code SQLITE_CONSTRAINT. But any changes to the database that the command made prior to encountering the constraint violation are preserved and are not backed out. 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 a constraint violation occurs, the one row that contains the constraint violation is not inserted or changed. But the command continues executing normally. Other rows before and after the row that contained the constraint violation continue to be inserted or updated normally. No error is returned.</p> </dd> <dt><b>REPLACE</b> </dt> <dd> <p> When a UNIQUE constraint violation occurs, the pre-existing rows that are causing the constraint violation are removed prior to inserting or updating the current row. Thus the insert or update always occurs. The command continues executing normally. No error is returned. If a NOT NULL constraint violation occurs, the NULL value is replaced by the default value for that column. If the column has no default value, then the ABORT algorithm is used. If a CHECK constraint violation occurs then the IGNORE algorithm is used.</p> <p> When this conflict resolution strategy deletes rows in order to satisfy a constraint, it does not invoke delete triggers on those rows. This behavior might change in a future release.</p> </dd> </dl> <p> The algorithm specified in the OR clause of a INSERT or UPDATE overrides any algorithm specified in a CREATE TABLE. If no algorithm is specified anywhere, the ABORT algorithm is used.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>CREATE INDEX</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">CREATE INDEX</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</h1> <h4> CREATE INDEX</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">UNIQUE</font></b>]<b><font color="#2c2cf0"> INDEX </font></b>[<b><font color="#2c2cf0">IF NOT EXISTS</font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">index-name</font></i><b><font color="#2c2cf0"> <br /> ON </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> <big>(</big> </font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b><i><font color="#ff3434"> column-name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"> <big>)</big></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">column-name</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> COLLATE </font></b><i><font color="#ff3434">collation-name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> ASC </font></b><big>|</big><b><font color="#2c2cf0"> DESC </font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <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. Each column name can be followed by one of the "ASC" or "DESC" keywords to indicate sort order, but the sort order is ignored in the current implementation. Sorting is always done in ascending order.</p> <p> The COLLATE clause following each column name defines a collating sequence used for text entires in that column. The default collating sequence is the collating sequence defined for that column in the CREATE TABLE 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, nor on the number of columns in an index.</p> <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.</p> <p> The exact text of each CREATE INDEX statement is stored in the <b>sqlite_master</b> or <b>sqlite_temp_master</b> table, depending on whether the table being indexed is temporary. Every time the database is opened, all CREATE INDEX statements are read from the <b>sqlite_master</b> table and used to regenerate SQLite's internal representation of the index layout.</p> <p> If the optional IF NOT EXISTS clause is present and another index with the same name aleady 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> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>CREATE TABLE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">CREATE TABLE</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</h1> <h4> CREATE TABLE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-command</font></i> ::=</td> <td> <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b> <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0"> TABLE </font></b>[<b><font color="#2c2cf0">IF NOT EXISTS</font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> <big>(</big><br /> </font></b><i><font color="#ff3434">column-def</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b><i><font color="#ff3434"> column-def</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b> <i><font color="#ff3434">constraint</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"><br /> <big>)</big></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-command</font></i> ::=</td> <td> <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b> <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0"> TABLE </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"><big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> AS </font> </b><i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">column-def</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">type</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b>[<b><font color="#2c2cf0">CONSTRAINT </font></b><i><font color="#ff3434">name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434"> column-constraint</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">type</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">typename</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">typename</font></i><b><font color="#2c2cf0"> <big> (</big> </font></b><i><font color="#ff3434">number</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">typename</font></i><b><font color="#2c2cf0"> <big> (</big> </font></b><i><font color="#ff3434">number</font></i><b><font color="#2c2cf0"> <big>,</big> </font></b><i><font color="#ff3434">number</font></i><b><font color="#2c2cf0"> <big>)</big></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">column-constraint</font></i> ::=</td> <td> <b><font color="#2c2cf0">NOT NULL </font></b>[<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">conflict-clause</font></i><b><font color="#2c2cf0"> </font> </b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> PRIMARY KEY </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">sort-order</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">conflict-clause</font></i><b><font color="#2c2cf0"> </font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">AUTOINCREMENT</font></b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> UNIQUE </font></b>[<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">conflict-clause</font></i><b><font color="#2c2cf0"> </font></b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> CHECK <big>(</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br /> DEFAULT </font></b><i><font color="#ff3434">value</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> COLLATE </font></b><i><font color="#ff3434">collation-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">constraint</font></i> ::=</td> <td> <b><font color="#2c2cf0">PRIMARY KEY <big>(</big> </font></b><i><font color="#ff3434"> column-list</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b>[<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">conflict-clause</font></i><b><font color="#2c2cf0"> </font></b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> UNIQUE <big>(</big> </font></b><i><font color="#ff3434">column-list</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b>[<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">conflict-clause</font></i><b><font color="#2c2cf0"> </font> </b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> CHECK <big>(</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> <big>)</big></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">conflict-clause</font></i> ::=</td> <td> <b><font color="#2c2cf0">ON CONFLICT </font></b><i><font color="#ff3434">conflict-algorithm</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> A CREATE TABLE statement is basically the keywords "CREATE TABLE" followed by the name of a new table and a parenthesized list of column definitions and constraints. The table name can be either an identifier or a string. Tables names that begin with "<b>sqlite_</b>" are reserved for use by the engine.</p> <p> Each column definition is the name of the column followed by the datatype for that column, then one or more optional column constraints. The datatype for the column does not restrict what data may be put in that column. See <a href="http://www.sqlite.org/datatype3.html"> Datatypes In SQLite Version 3</a> for additional information. The UNIQUE constraint causes an index to be created on the specified columns. This index must contain unique keys. The COLLATE clause specifies what text <a href="http://www.sqlite.org/datatype3.html#collation"> collating function</a> to use when comparing text entries for the column. The built-in BINARY collating function is used by default. </p> <p> The DEFAULT constraint specifies a default value to use when doing an INSERT. The value may be NULL, a string constant or a number. Starting with version 3.1.0, the default value may also be one of the special case-independant keywords CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP. If the value is NULL, a string constant or number, it is literally inserted into the column whenever an INSERT statement that does not specify a value for the column is executed. If the value is CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP, then the current UTC date and/or time is inserted into the columns. For CURRENT_TIME, the format is HH:MM:SS. For CURRENT_DATE, YYYY-MM-DD. The format for CURRENT_TIMESTAMP is "YYYY-MM-DD HH:MM:SS". </p> <p> Specifying a PRIMARY KEY normally just creates a UNIQUE index on the corresponding columns. However, if primary key is on a single column that has datatype INTEGER, then that column is used internally as the actual key of the B-Tree for the table. This means that the column may only hold unique integer values. (Except for this one case, SQLite ignores the datatype specification of columns and allows any kind of data to be put in a column regardless of its declared datatype.) If a table does not have an INTEGER PRIMARY KEY column, then the B-Tree key will be a automatically generated integer. The B-Tree key for a row can always be accessed using one of the special names "<b>ROWID</b>", "<b>OID</b>", or "<b>_ROWID_</b>". This is true regardless of whether or not there is an INTEGER PRIMARY KEY. An INTEGER PRIMARY KEY column man also include the keyword AUTOINCREMENT. The AUTOINCREMENT keyword modified the way that B-Tree keys are automatically generated. Additional detail on automatic B-Tree key generation is available <a href="http://www.sqlite.org/autoinc.html"> separately</a>.</p> <p> If the "TEMP" or "TEMPORARY" keyword occurs in between "CREATE" and "TABLE" then the table that is created is only visible within that same database connection and is automatically deleted when the database connection is closed. Any indices created on a temporary table are also temporary. Temporary tables and indices are stored in a separate file distinct from the main database file.</p> <p> If a <database-name> is specified, then the table is created in the named database. It is an error to specify both a <database-name> and the TEMP keyword, unless the <database-name> is "temp". If no database name is specified, and the TEMP keyword is not present, the table is created in the main database.</p> <p> The optional conflict-clause following each constraint allows the specification of an alternative default constraint conflict resolution algorithm for that constraint. The default is abort ABORT. Different constraints within the same table may have different default conflict resolution algorithms. If an COPY, INSERT, or UPDATE command specifies a different conflict resolution algorithm, then that algorithm is used in place of the default algorithm specified in the CREATE TABLE statement. See the section titled <a href="lang_conflict.html">ON CONFLICT</a> for additional information.</p> <p> CHECK constraints are supported as of version 3.3.0. Prior to version 3.3.0, CHECK constraints were parsed but not enforced.</p> <p> There are no arbitrary limits on the number of columns or on the number of constraints in a table. The total amount of data in a single row is limited to about 1 megabytes in version 2.8. In version 3.0 there is no arbitrary limit on the amount of data in a row.</p> <p> The CREATE TABLE AS form defines the table to be the result set of a query. The names of the table columns are the names of the columns in the result.</p> <p> The exact text of each CREATE TABLE statement is stored in the <b>sqlite_master</b> table. Every time the database is opened, all CREATE TABLE statements are read from the <b>sqlite_master</b> table and used to regenerate SQLite's internal representation of the table layout. If the original command was a CREATE TABLE AS then then an equivalent CREATE TABLE statement is synthesized and store in <b>sqlite_master</b> in place of the original command. The text of CREATE TEMPORARY TABLE statements are stored in the <b>sqlite_temp_master</b> table. </p> <p> If the optional IF NOT EXISTS clause is present and another table with the same name aleady exists, then this command becomes a no-op.</p> <p> Tables are removed using the <a href="lang_droptable.html">DROP TABLE</a> statement. </p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>CREATE TABLE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">CREATE TRIGGER</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</h1> <h4> CREATE TRIGGER</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b> <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0"> TRIGGER </font></b><i><font color="#ff3434">trigger-name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> BEFORE </font></b><big>|</big><b><font color="#2c2cf0"> AFTER </font></b>]<b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">database-event</font></i><b><font color="#2c2cf0"> ON </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">trigger-action</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b> <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0"> TRIGGER </font></b><i><font color="#ff3434">trigger-name</font></i><b><font color="#2c2cf0"> INSTEAD OF<br /> </font></b><i><font color="#ff3434">database-event</font></i><b><font color="#2c2cf0"> ON </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">view-name</font></i><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">trigger-action</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">database-event</font></i> ::=</td> <td> <b><font color="#2c2cf0">DELETE </font></b><big>|</big><b><font color="#2c2cf0"> <br /> INSERT </font></b><big>|</big><b><font color="#2c2cf0"> <br /> UPDATE </font></b><big>|</big><b><font color="#2c2cf0"> <br /> UPDATE OF </font></b><i><font color="#ff3434">column-list</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">trigger-action</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b>[<b><font color="#2c2cf0"> FOR EACH ROW </font> </b><big>|</big><b><font color="#2c2cf0"> FOR EACH STATEMENT </font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> WHEN </font></b><i><font color="#ff3434"> expression</font></i><b><font color="#2c2cf0"> </font></b>]<b><font color="#2c2cf0"> <br /> BEGIN <br /> </font></b><i><font color="#ff3434">trigger-step</font></i><b><font color="#2c2cf0"> ; </font></b>[<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434"> trigger-step</font></i><b><font color="#2c2cf0"> ; </font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"><br /> END</font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">trigger-step</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">update-statement</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">insert-statement</font></i><b><font color="#2c2cf0"> </font></b> <big>|</big><b><font color="#2c2cf0"> <br /> </font></b><i><font color="#ff3434">delete-statement</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434"> select-statement</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The CREATE TRIGGER statement is used to add triggers to the database schema. Triggers are database operations (the <i>trigger-action</i>) that are automatically performed when a specified database event (the <i>database-event</i>) occurs. </p> <p> A trigger may be specified to fire whenever a DELETE, INSERT or UPDATE of a particular database table occurs, or whenever an UPDATE of one or more specified columns of a table are updated.</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 as <i>trigger-steps</i> 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 <i>trigger-steps</i> 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 <i>trigger-event</i>s for which they are relevant, as follows:</p> <p> <table border="0" cellpadding="10"> <tr> <td align="right" valign="top" width="120"> <i>INSERT</i></td> <td valign="top"> NEW references are valid</td> </tr> <tr> <td align="right" valign="top" width="120"> <i>UPDATE</i></td> <td valign="top"> NEW and OLD references are valid</td> </tr> <tr> <td align="right" valign="top" width="120"> <i>DELETE</i></td> <td valign="top"> OLD references are valid</td> </tr> </table> </p> <p> </p> <p> If a WHEN clause is supplied, the SQL statements specified as <i>trigger-steps</i> 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 specified <i>trigger-time</i> determines when the <i>trigger-steps</i> will be executed relative to the insertion, modification or removal of the associated row.</p> <p> An ON CONFLICT clause may be specified as part of an UPDATE or INSERT <i>trigger-step</i>. However if an ON CONFLICT clause is specified as part of the statement causing the trigger to fire, then this conflict handling policy is used instead.</p> <p> Triggers are automatically dropped when the table that they are associated with is dropped.</p> <p> Triggers may be created on views, 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. Thereafter, 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> <b>Example:</b></p> <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> <p> Note that currently, triggers may behave oddly when created on tables with INTEGER PRIMARY KEY fields. If a BEFORE trigger program modifies the INTEGER PRIMARY KEY field of a row that will be subsequently updated by the statement that causes the trigger to fire, then the update may not occur. The workaround is to declare the table with a PRIMARY KEY column instead of an INTEGER PRIMARY KEY column.</p> <p> A special SQL function RAISE() may be used within a trigger-program, with the following syntax</p> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">raise-function</font></i> ::=</td> <td> <b><font color="#2c2cf0">RAISE <big>(</big> ABORT<big>,</big> </font></b><i><font color="#ff3434">error-message</font></i><b><font color="#2c2cf0"> <big>)</big> </font> </b><big>|</big><b><font color="#2c2cf0"> <br /> RAISE <big>(</big> FAIL<big>,</big> </font></b><i><font color="#ff3434">error-message</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"> <br /> RAISE <big>(</big> ROLLBACK<big>,</big> </font></b><i><font color="#ff3434">error-message</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"> <br /> RAISE <big>(</big> IGNORE <big>)</big></font></b></td> </tr> </table> </p> <p> When one of the first three forms is called during trigger-program execution, the specified ON CONFLICT processing is performed (either ABORT, FAIL or ROLLBACK) and the current query terminates. An error code of SQLITE_CONSTRAINT is returned to the user, 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 of 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> <p> Triggers are removed using the <a href="lang_droptrigger.html">DROP TRIGGER</a> statement.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>CREATE VIEW</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">CREATE VIEW</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</h1> <h4> CREATE VIEW</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-command</font></i> ::=</td> <td> <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b> <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0"> VIEW </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"><big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">view-name</font></i><b><font color="#2c2cf0"> AS </font></b> <i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <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 SELECT 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, unless the <database-name> is "temp". If no database name is specified, and the TEMP keyword is not present, the table is created in the main database.</p> <p> You cannot COPY, DELETE, INSERT or UPDATE a view. Views are read-only in SQLite. However, in many cases you can use a <a href="lang_createtrigger.html">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> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>CREATE VIRTUAL TABLE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">CREATE VIRTUAL TABLE</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</h1> <h4> CREATE VIRTUAL TABLE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-command</font></i> ::=</td> <td> <b><font color="#2c2cf0">CREATE VIRTUAL TABLE </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> USING </font></b><i><font color="#ff3434">module-name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>(</big> </font></b> <i><font color="#ff3434">arguments</font></i><b><font color="#2c2cf0"> <big>)</big></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> A virtual table 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 virtual table that can be done with an ordinary table, except that you cannot create 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="capi3ref.html#sqlite3_create_module">sqlite3_create_module</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 column definitions in a traditional <a href="lang_createtable.html">CREATE TABLE</a> statement. SQLite passes the module arguments directly to the module 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> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>DELETE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">DELETE</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</h1> <h4> DELETE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">DELETE FROM </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">WHERE </font></b><i><font color="#ff3434"> expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The DELETE command is used to remove records from a table. The command consists of the "DELETE FROM" keywords followed by the name of the table from which records are to be removed. </p> <p> Without a WHERE clause, all rows of the table are removed. If a WHERE clause is supplied, then only those rows that match the expression are removed.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>DETACH</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">DETACH</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</h1> <h4> DETACH</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-command</font></i> ::=</td> <td> <b><font color="#2c2cf0">DETACH </font></b>[<b><font color="#2c2cf0">DATABASE</font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> This statement detaches an additional database connection previously attached using the <a href="lang_attach.html">ATTACH DATABASE</a> statement. 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> <p> This statement will fail if SQLite is in the middle of a transaction.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>DROP INDEX</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">DROP INDEX</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</h1> <h4> DROP INDEX</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-command</font></i> ::=</td> <td> <b><font color="#2c2cf0">DROP INDEX </font></b>[<b><font color="#2c2cf0">IF EXISTS</font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">index-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The DROP INDEX statement removes an index added with the <a href="lang_createindex.html"> CREATE INDEX</a> statement. The index named is completely removed from the disk. The only way to recover the index is to reenter the appropriate CREATE INDEX command.</p> <p> The DROP INDEX statement does not reduce the size of the database file in the default mode. Empty space in the database is retained for later INSERTs. To remove free space in the database, use the <a href="lang_vacuum.html"> VACUUM</a> command. If AUTOVACUUM mode is enabled for a database then space will be freed automatically by DROP INDEX.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>DROP TABLE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">DROP TABLE</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</h1> <h4> DROP TABLE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-command</font></i> ::=</td> <td> <b><font color="#2c2cf0">DROP TABLE </font></b>[<b><font color="#2c2cf0">IF EXISTS</font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"><big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The DROP TABLE statement removes a table added with the <a href="#createtable">CREATE TABLE</a> statement. The name specified is the table name. It is completely removed from the database schema and the disk file. The table can not be recovered. All indices associated with the table are also deleted.</p> <p> The DROP TABLE statement does not reduce the size of the database file in the default mode. Empty space in the database is retained for later INSERTs. To remove free space in the database, use the <a href="lang_vacuum.html"> VACUUM</a> command. If AUTOVACUUM mode is enabled for a database then space will be freed automatically by DROP TABLE.</p> <p> The optional IF EXISTS clause suppresses the error that would normally result if the table does not exist.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>DROP TRIGGER</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">DROP TRIGGER</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</h1> <h4> DROP TRIGGER</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">DROP TRIGGER </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">trigger-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The DROP TRIGGER statement removes a trigger created by the <a href="lang_createtrigger.html"> CREATE TRIGGER</a> statement. The trigger is deleted from the database schema. Note that triggers are automatically dropped when the associated table is dropped.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>DROP VIEW</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">DROP VIEW</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</h1> <h4> DROP VIEW</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-command</font></i> ::=</td> <td> <b><font color="#2c2cf0">DROP VIEW </font></b><i><font color="#ff3434">view-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The DROP VIEW statement removes a view created by the <a href="#createview">CREATE VIEW</a> statement. The name specified is the view name. It is removed from the database schema, but no actual data in the underlying base tables is modified.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>EXPLAIN</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">EXPLAIN</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</h1> <h4> EXPLAIN</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">EXPLAIN </font></b><i><font color="#ff3434">sql-statement</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The EXPLAIN command modifier is a non-standard extension. The idea comes from a similar command found in PostgreSQL, but the operation is completely different.</p> <p> If the EXPLAIN keyword appears before any other SQLite SQL command then instead of actually executing the command, the SQLite library will report back the sequence of virtual machine instructions it would have used to execute the command had the EXPLAIN keyword not been present. For additional information about virtual machine instructions see the <a href="http://www.sqlite.org/arch.html">architecture description</a> or the documentation on <a href="http://www.sqlite.org/opcode.html">available opcodes</a> for the virtual machine.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>expression</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">expression</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</h1> <h4> expression</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">expr</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">binary-op</font></i><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font> </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">like-op</font></i><b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">ESCAPE </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">unary-op</font></i><b><font color="#2c2cf0"> </font> </b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b> <big>|</big><b><font color="#2c2cf0"><br /> <big>(</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> <big>.</big> </font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> <big>.</big> </font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">literal-value</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">parameter</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">function-name</font></i><b><font color="#2c2cf0"> <big>(</big> </font></b><i><font color="#ff3434">expr-list</font></i><b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"> <big>*</big> <big>)</big> </font> </b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> ISNULL </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> NOTNULL </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font> </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> BETWEEN </font> </b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> AND </font></b> <i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b><big> |</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font> </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> IN <big>(</big> </font></b><i><font color="#ff3434">value-list</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font> </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> IN <big>(</big> </font></b><i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br /> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font> </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> IN </font></b> [<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b> <big>|</big><b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0">EXISTS</font></b>]<b><font color="#2c2cf0"> <big> (</big> </font></b><i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br /> CASE </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>(<b><font color="#2c2cf0"> WHEN </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> THEN </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b>)+<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">ELSE </font> </b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> END </font></b><big>|</big><b><font color="#2c2cf0"><br /> CAST <big>(</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> AS </font></b><i><font color="#ff3434">type</font></i><b><font color="#2c2cf0"> <big> )</big></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">like-op</font></i> ::=</td> <td> <b><font color="#2c2cf0">LIKE </font></b><big>|</big><b><font color="#2c2cf0"> GLOB </font></b><big>|</big><b><font color="#2c2cf0"> REGEXP </font></b><big>|</big><b><font color="#2c2cf0"> MATCH</font></b></td> </tr> </table> </p> <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> <p> SQLite understands the following binary operators, in order from highest to lowest precedence:</p> <blockquote> <pre> <font color="#2c2cf0"><big>|| * / % + - << >> & | < <= > >= = == != <> </big>IN AND OR</font> </pre> </blockquote> <p> Supported unary operators are these:</p> <blockquote> <pre> <font color="#2c2cf0"><big>- + ! ~ NOT</big></font> </pre> </blockquote> <p> The unary operator [Operator +] is a no-op. It can be applied to strings, numbers, or blobs and it always gives as its result the value of 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 remainder of its left operand modulo its right operand.</p> <p> The result of any binary operator is a numeric value, except for the <font color="#2c2cf0"> <big>||</big></font> concatenation operator which gives a string result.</p> <a name="literal_value"></a> <p> A literal value is an integer number or a floating point number. Scientific notation is supported. 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. 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'53514697465' </pre> </blockquote> <p> A literal value can also be the token "NULL". </p> <p> A parameter specifies a placeholder in the expression for a literal value that is filled in at runtime using the <a href="capi3ref.html#sqlite3_bind_int">sqlite3_bind</a> API. Parameters can take several forms: </p> <p> <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 999.</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 holds a spot for the next unused parameter.</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 named parameter with the name AAAA. Named parameters are also numbered. The number assigned is the next unused number. 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.</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 occurances of "::" and a suffix enclosed in "(...)" containing any text at all. This syntax is the form of a variable name in the Tcl programming language.</td> </tr> </table> </p> <blockquote> </blockquote> <p> Parameters that are not assigned values using <a href="capi3ref.html#sqlite3_bind_int"> sqlite3_bind</a> are treated as NULL.</p> <a name="like"></a> <p> The LIKE operator does a pattern matching comparison. The operand to the right contains the pattern, the left hand operand contains the string to match against the pattern. A percent symbol <font color="#2c2cf0"><big>%</big></font> in the pattern matches any sequence of zero or more characters in the string. An underscore <font color="#2c2cf0"> <big>_</big></font> in the pattern matches any single character in the string. Any other character matches itself or it's lower/upper case equivalent (i.e. case-insensitive matching). (A bug: SQLite only understands upper/lower case for 7-bit Latin characters. Hence the LIKE operator is case sensitive for 8-bit iso8859 characters or UTF-8 characters. 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 itself matches a literal percent symbol, underscore or escape character in the string, respectively. The infix LIKE operator is implemented by calling the user function <a href="#likeFunc"> like(<i>X</i>,<i>Y</i>)</a>.</p> <p> The LIKE operator is not case sensitive and will match upper case characters on one side against lower case characters on the other. (A bug: SQLite only understands upper/lower case for 7-bit Latin characters. Hence the LIKE operator is case sensitive for 8-bit iso8859 characters or UTF-8 characters. For example, the expression <b>'a' LIKE 'A'</b> is TRUE but <b>'æ' LIKE 'Æ'</b> is FALSE.). </p> <p> </p> <p> The infix LIKE operator is implemented by calling the user function <a href="#likeFunc"> like(<i>X</i>,<i>Y</i>)</a>. If an ESCAPE clause is present, it adds a third parameter to the function call. If the functionality of LIKE can be overridden by defining an alternative implementation of the like() SQL function.</p> <p> </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 user function <a href="#globFunc">glob(<i>X</i>,<i>Y</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 a user-defined function named "regexp" is added at run-time, that function will be called in order to implement the REGEXP operator.</p> <a name="match"></a> <p> The MATCH operator is a special syntax for the match() user function. The default match() function implementation raises and exception and is not really useful for anything. But extensions can override the match() function with more helpful logic.</p> <p> A column name can be any of the names defined in the CREATE TABLE 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 random integer key (the "row key") associated with every row of every table. The special identifiers only refer to the row key if the CREATE TABLE statement does not define a real column with the same name. Row keys act like read-only columns. A row key can be used anywhere a regular column can be used, except that you cannot change the value of a row key in an UPDATE or INSERT statement. "SELECT * ..." does not return the row key.</p> <p> SELECT statements can appear in expressions as either the right-hand operand of the IN operator, as a scalar quantity, or as the operand of an EXISTS operator. As a scalar quantity or the operand of an IN operator, the SELECT should have only a single column in its result. Compound SELECTs (connected with keywords like UNION or EXCEPT) are allowed. With the EXISTS operator, the columns in the result set of the SELECT are ignored and the expression returns TRUE if one or more rows exist and FALSE if the result set is empty. If no terms in the SELECT expression refer to value in the containing query, then the expression is evaluated once prior to any other processing and the result is reused as necessary. If the SELECT expression does contain variables from the outer query, then the SELECT is reevaluated every time it is needed.</p> <p> When a SELECT is the right operand of the IN operator, the IN operator returns TRUE if the result of the left operand is any of the values generated by the select. The IN operator may be preceded by the NOT keyword to invert the sense of the test.</p> <p> When a SELECT appears within an expression but is not the right operand of an IN operator, then the first row of the result of the SELECT becomes the value used in the expression. 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 SELECT is NULL.</p> <p> A CAST expression changes the datatype of the <expr> </expr> into the type specified by <type>. <type> can be any non-empty type name that is valid for the type in a column definition of a CREATE TABLE statement.</p> <p> Both simple and aggregate functions are supported. 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> <p> <a name="corefunctions"></a><b>Core Functions</b> </p> <p> The core functions shown below are available by default. Additional functions may be written in C and added to the database engine using the <a href="capi3ref.html#cfunc"> sqlite3_create_function()</a> API.</p> <p> <table border="0" cellpadding="10"> <tr> <td align="right" valign="top" width="120"> abs(<i>X</i>)</td> <td valign="top"> Return the absolute value of argument <i>X</i>.</td> </tr> <tr> <td align="right" valign="top"> coalesce(<i>X</i>,<i>Y</i>,...)</td> <td valign="top"> Return a copy of the first non-NULL argument. If all arguments are NULL then NULL is returned. There must be at least 2 arguments.</td> </tr> <tr> <a name="globFunc"></a> <td align="right" valign="top"> glob(<i>X</i>,<i>Y</i>)</td> <td valign="top"> This function is used to implement the "<b>X GLOB Y</b>" syntax of SQLite. The <a href="capi3ref.html#sqlite3_create_function">sqlite3_create_function()</a> interface can be used to override this function and thereby change the operation of the <a href="#globFunc">GLOB</a> operator.</td> </tr> <tr> <td align="right" valign="top"> ifnull(<i>X</i>,<i>Y</i>)</td> <td valign="top"> Return a copy of the first non-NULL argument. If both arguments are NULL then NULL is returned. This behaves the same as <b>coalesce()</b> above.</td> </tr> <tr> <td align="right" valign="top"> last_insert_rowid()</td> <td valign="top"> Return the ROWID of the last row insert from this connection to the database. This is the same value that would be returned from the <b>sqlite_last_insert_rowid()</b> API function.</td> </tr> <tr> <td align="right" valign="top"> length(<i>X</i>)</td> <td valign="top"> Return the string length of <i>X</i> in characters. If SQLite is configured to support UTF-8, then the number of UTF-8 characters is returned, not the number of bytes.</td> </tr> <tr> <a name="likeFunc"></a> <td align="right" valign="top"> like(<i>X</i>,<i>Y</i> [,<i>Z</i>])</td> <td valign="top"> This function is used to implement the "<b>X LIKE Y [ESCAPE Z]</b>" syntax of SQL. If the optional ESCAPE clause is present, then the user-function is invoked with three arguments. Otherwise, it is invoked with two arguments only. The <a href="capi3ref.html#sqlite3_create_function"> sqlite_create_function()</a> interface can be used to override this function and thereby change the operation of the <a href="#like">LIKE</a> operator. When doing this, 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 LIKE operator depending on whether or not an ESCAPE clause was specified.</td> </tr> <tr> <td align="right" valign="top"> load_extension(<i>X</i>)<br /> load_extension(<i>X</i>,<i>Y</i>)</td> <td valign="top"> Load SQLite extensions out of the shared library file named <i>X</i> using the entry point <i>Y</i>. The result is a NULL. If <i>Y</i> is omitted then the default entry point of <b>sqlite3_extension_init</b> is used. This function raises an exception if the extension fails to load or initialize correctly. </td> </tr> <tr> <td align="right" valign="top"> lower(<i>X</i>)</td> <td valign="top"> Return a copy of string <i>X</i> will all characters converted to lower case. The C library <b>tolower()</b> routine is used for the conversion, which means that this function might not work correctly on UTF-8 characters.</td> </tr> <tr> <td align="right" valign="top"> max(<i>X</i>,<i>Y</i>,...)</td> <td valign="top"> Return the argument with the maximum value. Arguments may be strings in addition to numbers. The maximum value is determined by the usual sort order. Note that <b> max()</b> is a simple function when it has 2 or more arguments but converts to an aggregate function if given only a single argument.</td> </tr> <tr> <td align="right" valign="top"> min(<i>X</i>,<i>Y</i>,...)</td> <td valign="top"> Return the argument with the minimum value. Arguments may be strings in addition to numbers. The minimum value is determined by the usual sort order. Note that <b> min()</b> is a simple function when it has 2 or more arguments but converts to an aggregate function if given only a single argument.</td> </tr> <tr> <td align="right" valign="top"> nullif(<i>X</i>,<i>Y</i>)</td> <td valign="top"> Return the first argument if the arguments are different, otherwise return NULL.</td> </tr> <tr> <td align="right" valign="top"> quote(<i>X</i>)</td> <td valign="top"> This routine returns a string which is the value of its argument suitable for inclusion into another SQL statement. Strings are surrounded by single-quotes with escapes on interior quotes as needed. BLOBs are encoded as hexadecimal literals. The current implementation of VACUUM uses this function. The function is also useful when writing triggers to implement undo/redo functionality. </td> </tr> <tr> <td align="right" valign="top"> random(*)</td> <td valign="top"> Return a pseudo-random integer between -9223372036854775808 and +9223372036854775807.</td> </tr> <tr> <td align="right" valign="top"> round(<i>X</i>)<br /> round(<i>X</i>,<i>Y</i>)</td> <td valign="top"> Round off the number <i>X</i> to <i>Y</i> digits to the right of the decimal point. If the <i>Y</i> argument is omitted, 0 is assumed.</td> </tr> <tr> <td align="right" valign="top"> soundex(<i>X</i>)</td> <td valign="top"> Compute the soundex encoding of the string <i>X</i>. The string "?000" is returned if the argument is NULL. This function is omitted from SQLite by default. It is only available the -DSQLITE_SOUNDEX=1 compiler option is used when SQLite is built.</td> </tr> <tr> <td align="right" valign="top"> sqlite_version(*)</td> <td valign="top"> Return the version string for the SQLite library that is running. Example: "2.8.0"</td> </tr> <tr> <td align="right" valign="top"> substr(<i>X</i>,<i>Y</i>,<i>Z</i>)</td> <td valign="top"> Return a substring of input string <i>X</i> that begins with the <i>Y</i>-th character and which is <i>Z</i> characters long. The left-most character of <i>X</i> is number 1. If <i>Y</i> is negative the the first character of the substring is found by counting from the right rather than the left. If SQLite is configured to support UTF-8, then characters indices refer to actual UTF-8 characters, not bytes.</td> </tr> <tr> <td align="right" valign="top"> typeof(<i>X</i>)</td> <td valign="top"> Return the type of the expression <i>X</i>. The only return values are "null", "integer", "real", "text", and "blob". SQLite's type handling is explained in <a href="http://www.sqlite.org/datatype3.html"> Datatypes in SQLite Version 3</a>.</td> </tr> <tr> <td align="right" valign="top"> upper(<i>X</i>)</td> <td valign="top"> Return a copy of input string <i>X</i> converted to all upper-case letters. The implementation of this function uses the C library routine <b>toupper()</b> which means it may not work correctly on UTF-8 strings.</td> </tr> </table> <b>Date And Time Functions</b> </p> <p> Date and time functions are documented in the <a href="http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions"> SQLite Wiki</a>.</p> <p> <a name="aggregatefunctions"></a><b>Aggregate Functions</b> </p> <p> The aggregate functions shown below are available by default. Additional aggregate functions written in C may be added using the <a href="capi3ref.html#sqlite3_create_function"> sqlite3_create_function()</a> API.</p> <p> In any aggregate function that takes a single argument, that argument can be preceeded 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> <p> <table border="0" cellpadding="10"> <tr> <td align="right" valign="top" width="120"> avg(<i>X</i>)</td> <td valign="top"> Return 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 even if all inputs are integers. <p> </p> </td> </tr> <tr> <td align="right" valign="top"> count(<i>X</i>)<br /> count(*)</td> <td valign="top"> The first form return a count of the number of times that <i>X</i> is not NULL in a group. The second form (with no argument) returns the total number of rows in the group.</td> </tr> <tr> <td align="right" valign="top"> max(<i>X</i>)</td> <td valign="top"> Return the maximum value of all values in the group. The usual sort order is used to determine the maximum.</td> </tr> <tr> <td align="right" valign="top"> min(<i>X</i>)</td> <td valign="top"> Return the minimum non-NULL value of all values in the group. The usual sort order is used to determine the minimum. NULL is only returned if all values in the group are NULL.</td> </tr> <tr> <td align="right" valign="top"> sum(<i>X</i>)<br /> total(<i>X</i>)</td> <td valign="top"> Return the numeric 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> <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 exception.</p> </td> </tr> </table> </p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>INSERT</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">INSERT</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</h1> <h4> INSERT</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">INSERT </font></b>[<b><font color="#2c2cf0">OR </font></b> <i><font color="#ff3434">conflict-algorithm</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> INTO </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b> [<b><font color="#2c2cf0"><big>(</big></font></b><i><font color="#ff3434">column-list</font></i><b><font color="#2c2cf0"><big>)</big></font></b>]<b><font color="#2c2cf0"> VALUES<big>(</big></font></b><i><font color="#ff3434">value-list</font></i><b><font color="#2c2cf0"><big>)</big> </font> </b><big>|</big><b><font color="#2c2cf0"><br /> INSERT </font></b>[<b><font color="#2c2cf0">OR </font></b><i><font color="#ff3434"> conflict-algorithm</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> INTO </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b> [<b><font color="#2c2cf0"><big>(</big></font></b><i><font color="#ff3434">column-list</font></i><b><font color="#2c2cf0"><big>)</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The INSERT statement comes in two basic forms. The first form (with the "VALUES" keyword) creates a single new row in an existing table. If no column-list is specified then the number of values must be the same as the number of columns in the table. If a column-list is specified, then the number of values must match the number of specified columns. Columns of the table that do not appear in the column list are filled with the default value, or with NULL if not default value is specified. </p> <p> The second form of the INSERT statement takes it data from a SELECT statement. The number of columns in the result of the SELECT must exactly match the number of columns in the table if no column list is specified, or it must match the number of columns name in the column list. A new entry is made in the table for every row of the SELECT result. The SELECT may be simple or compound. If the SELECT statement has an ORDER BY clause, the ORDER BY is ignored.</p> <p> The optional conflict-clause allows the specification of an alternative constraint conflict resolution algorithm to use during this one 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> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>REINDEX</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> REINDEX </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</h1> <h4> REINDEX</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">REINDEX </font></b><i><font color="#ff3434">collation name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">REINDEX </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table/index-name</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <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> In the first form, all indices in all attached databases that use the named collation sequence are recreated. In the second form, if <i>[database-name.]table/index-name</i> identifies a table, then all indices associated with the table are rebuilt. If an index is identified, then only this specific index is deleted and recreated. </p> <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, then indices associated with the collation sequence only are reconstructed. This ambiguity may be dispelled by always specifying a <i>database-name</i> when reindexing a specific table or index. </p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>REPLACE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> REPLACE </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</h1> <h4> REPLACE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">REPLACE INTO </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>(</big> </font></b> <i><font color="#ff3434">column-list</font></i><b><font color="#2c2cf0"> <big>)</big></font></b>]<b><font color="#2c2cf0"> VALUES <big>(</big> </font></b><i><font color="#ff3434">value-list</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br /> REPLACE INTO </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b> [<b><font color="#2c2cf0"><big>(</big> </font></b><i><font color="#ff3434">column-list</font></i><b><font color="#2c2cf0"> <big>)</big></font></b>]<b><font color="#2c2cf0"> </font></b> <i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The REPLACE command is an alias for the "INSERT OR REPLACE" variant of the <a href="lang_insert.html"> INSERT</a> command. This alias is provided for compatibility with MySQL. See the <a href="lang_insert.html">INSERT</a> command documentation for additional information.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>SELECT</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> SELECT </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</h1> <h4> SELECT</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">SELECT </font></b>[<b><font color="#2c2cf0">ALL </font></b> <big>|</big><b><font color="#2c2cf0"> DISTINCT</font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">result</font></i><b><font color="#2c2cf0"> </font> </b>[<b><font color="#2c2cf0">FROM </font></b><i><font color="#ff3434">table-list</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0">WHERE </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0">GROUP BY </font></b><i><font color="#ff3434"> expr-list</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0">HAVING </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">compound-op</font></i><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">select</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0">ORDER BY </font></b><i><font color="#ff3434"> sort-expr-list</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0">LIMIT </font></b><i><font color="#ff3434">integer</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b>(<b><font color="#2c2cf0"> OFFSET </font></b><big>|</big><b><font color="#2c2cf0"> <big>,</big> </font></b> )<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">integer</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">result</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">result-column</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b> <i><font color="#ff3434">result-column</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">result-column</font></i> ::=</td> <td> <b><font color="#2c2cf0"><big>*</big> </font></b><big>|</big><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> <big>.</big> <big>*</big> </font></b><big>|</big><b><font color="#2c2cf0"> </font> </b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b> [<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">AS</font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">string</font></i><b><font color="#2c2cf0"> </font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">table-list</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">table</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">join-op</font></i><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table</font></i><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">join-args</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">table</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">AS </font></b><i><font color="#ff3434"> alias</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font> </b><big>|</big><b><font color="#2c2cf0"><br /> <big>(</big> </font></b><i><font color="#ff3434">select</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b>[<b><font color="#2c2cf0">AS </font></b><i><font color="#ff3434"> alias</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">join-op</font></i> ::=</td> <td> <b><font color="#2c2cf0"><big>,</big> </font></b><big>|</big><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">NATURAL</font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">LEFT </font></b><big>|</big><b><font color="#2c2cf0"> RIGHT </font></b><big>|</big><b><font color="#2c2cf0"> FULL</font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">OUTER </font></b><big>|</big><b><font color="#2c2cf0"> INNER </font></b><big>|</big><b><font color="#2c2cf0"> CROSS</font></b>]<b><font color="#2c2cf0"> JOIN</font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">join-args</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b>[<b><font color="#2c2cf0">ON </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">USING <big>(</big> </font></b><i><font color="#ff3434"> id-list</font></i><b><font color="#2c2cf0"> <big>)</big></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sort-expr-list</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">sort-order</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font> </b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">sort-order</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sort-order</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b>[<b><font color="#2c2cf0"> COLLATE </font></b> <i><font color="#ff3434">collation-name</font></i><b><font color="#2c2cf0"> </font> </b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> ASC </font></b> <big>|</big><b><font color="#2c2cf0"> DESC </font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">compound_op</font></i> ::=</td> <td> <b><font color="#2c2cf0">UNION </font></b><big>|</big><b><font color="#2c2cf0"> UNION ALL </font></b><big>|</big><b><font color="#2c2cf0"> INTERSECT </font></b><big>|</big><b><font color="#2c2cf0"> EXCEPT</font></b></td> </tr> </table> </p> <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. The number of columns in the result is specified by the expression list in between the SELECT and FROM keywords. Any arbitrary expression can be used as a result. If a result expression is <font color="#2c2cf0"><big>*</big></font> then all columns of all tables are substituted for that one expression. If the expression is the name of a table followed by <font color="#2c2cf0"><big>.*</big></font> then the result is all columns in that one table.</p> <p> The DISTINCT keyword causes a subset of result rows to be returned, in which each result row is different. NULL values are not treated as distinct from each other. The default behavior is that all result rows be returned, which can be made explicit with the keyword ALL.</p> <p> The query is executed against one or more tables specified after the FROM keyword. If multiple tables names are separated by commas, then the query is against the cross join of the various tables. The full SQL-92 join syntax can also be used to specify joins. A sub-query in parentheses may be substituted for any table name in the FROM clause. The entire FROM clause may be omitted, in which case the result is a single row consisting of the values of the expression list. </p> <p> The WHERE clause can be used to limit the number of rows over which the query operates.</p> <p> The GROUP BY clauses causes one or more rows of the result to be combined into a single row of output. This is especially useful when the result contains aggregate functions. The expressions in the GROUP BY clause do <em>not</em> have to be expressions that appear in the result. The HAVING clause is similar to WHERE except that HAVING applies after grouping has occurred. The HAVING expression may refer to values, even aggregate functions, that are not in the result.</p> <p> The ORDER BY clause causes the output rows to be sorted. The argument to ORDER BY is a list of expressions that are used as the key for the sort. The expressions do not have to be part of the result for a simple SELECT, but in a compound SELECT each sort expression must exactly match one of the result columns. Each sort expression may be optionally followed by a COLLATE keyword and the name of a collating function used for ordering text and/or keywords ASC or DESC to specify the sort order.</p> <p> The LIMIT clause places an upper bound on the number of rows returned in the result. A negative LIMIT indicates no upper bound. The optional OFFSET following LIMIT specifies how many rows to skip at the beginning of the result set. In a compound query, the LIMIT clause may only appear on the final SELECT statement. The limit is applied to the entire query not to the individual SELECT statement to which it is attached. Note that if the OFFSET keyword is used in the LIMIT clause, then the limit is the first number and the offset is the second number. If a comma is used instead of the OFFSET keyword, then the offset is the first number and the limit is the second number. This seeming contradition is intentional - it maximizes compatibility with legacy SQL database systems. </p> <p> A compound SELECT is formed from two or more simple SELECTs connected by one of the operators UNION, UNION ALL, INTERSECT, or EXCEPT. In a compound SELECT, all the constituent SELECTs must specify the same number of result columns. There may be only a single ORDER BY clause at the end of the compound SELECT. The UNION and UNION ALL operators combine the results of the SELECTs to the right and left into a single big table. The difference is that in UNION all result rows are distinct where in UNION ALL there may be duplicates. The INTERSECT operator takes the intersection of the results of the left and right SELECTs. EXCEPT takes the result of left SELECT after removing the results of the right SELECT. When three or more SELECTs are connected into a compound, they group from left to right.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>TRANSACTIONS</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">BEGIN TRANSACTION</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</h1> <h4> BEGIN TRANSACTION</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">BEGIN </font></b>[<b><font color="#2c2cf0"> DEFERRED </font> </b><big>|</big><b><font color="#2c2cf0"> IMMEDIATE </font></b><big>|</big><b><font color="#2c2cf0"> EXCLUSIVE </font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">TRANSACTION </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">END </font></b>[<b><font color="#2c2cf0">TRANSACTION </font> </b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">COMMIT </font></b>[<b><font color="#2c2cf0">TRANSACTION </font> </b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">ROLLBACK </font></b>[<b><font color="#2c2cf0">TRANSACTION </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> Beginning in version 2.0, SQLite supports transactions with rollback and atomic commit.</p> <p> The optional transaction name is ignored. SQLite currently does not allow nested transactions.</p> <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 SELECT) will automatically start a transaction if one is not already in effect. Automatically started transactions are committed at the conclusion of the command. </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> In SQLite version 3.0.8 and later, transactions can be deferred, immediate, or exclusive. 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. Locks are not acquired until the first read or write operation. The first read operation against a database creates a SHARED lock and the first write operation creates a RESERVED 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 RESERVED 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, you are guaranteed that no other thread or process 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 EXCLUSIVE locks to be acquired on all databases. After a BEGIN EXCLUSIVE, you are guaranteed that no other thread or process will be able to read or write the database until the transaction is complete. </p> <p> A description of the meaning of SHARED, RESERVED, and EXCLUSIVE locks is available <a href="lockingv3.html">separately</a>. </p> <p> The default behavior for SQLite version 3.0.8 is a deferred transaction. For SQLite version 3.0.0 through 3.0.7, deferred is the only kind of transaction available. For SQLite version 2.8 and earlier, all transactions are exclusive. </p> <p> The COMMIT command does not actually perform a commit until all pending SQL commands finish. Thus if two or more SELECT statements are in the middle of processing and a COMMIT is executed, the commit will not actually occur until all SELECT statements finish. </p> <p> An attempt to execute COMMIT might result in an SQLITE_BUSY return code. This indicates that another thread or process had a read lock 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> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>UPDATE</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> UPDATE </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</h1> <h4> UPDATE</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">UPDATE </font></b>[<b><font color="#2c2cf0"> OR </font></b> <i><font color="#ff3434">conflict-algorithm</font></i><b><font color="#2c2cf0"> </font> </b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"><br /> SET </font></b><i><font color="#ff3434">assignment</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b><i><font color="#ff3434"> assignment</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"><br /> </font></b>[<b><font color="#2c2cf0">WHERE </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> <tr> <td align="right" valign="top"> <i><font color="#ff3434">assignment</font></i> ::=</td> <td> <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0"> <big>=</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The UPDATE statement is used to change the value of columns in selected rows of a table. Each assignment in an UPDATE specifies a column name to the left of the equals sign and an arbitrary expression to the right. The expressions may use the values of other columns. All expressions are evaluated before any assignments are made. A WHERE clause can be used to restrict which rows are updated.</p> <p> The optional conflict-clause allows the specification of an alternative constraint conflict resolution algorithm to use during this one command. See the section titled <a href="lang_conflict.html">ON CONFLICT</a> for additional information.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>VACUUM</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> VACUUM </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</h1> <h4> VACUUM</h4> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">VACUUM </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">index-or-table-name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td> </tr> </table> </p> <p> The VACUUM command is an SQLite extension modeled after a similar command found in PostgreSQL. If VACUUM is invoked with the name of a table or index then it is suppose to clean up the named table or index. In version 1.0 of SQLite, the VACUUM command would invoke <b>gdbm_reorganize()</b> to clean up the backend database file.</p> <p> VACUUM became a no-op when the GDBM backend was removed from SQLITE in version 2.0.0. VACUUM was reimplemented in version 2.8.1. The index or table name argument is now ignored. </p> <p> When an object (table, index, or trigger) is dropped from the database, it leaves behind empty space. This makes the database file larger than it needs to be, but can speed up inserts. In time inserts and deletes can leave the database file structure fragmented, which slows down disk access to the database contents. The VACUUM command cleans the main database by copying its contents to a temporary database file and reloading the original database file from the copy. This eliminates free pages, aligns table data to be contiguous, and otherwise cleans up the database file structure. It is not possible to perform the same process on an attached database file.</p> <p> This command will fail if there is an active transaction. This command has no effect on an in-memory database.</p> <p> As of SQLite version 3.1, an alternative to using the VACUUM command is auto-vacuum mode, enabled using the <a href="pragma.html#pragma_auto_vacuum">auto_vacuum pragma</a>.</p> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 | <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>PRAGMA</title> <link rel="stylesheet" type="text/css" href="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <div id="header"> <table width="100%" id="topTable"> <tr id="headerTableRow1"> <td align="left"> <span id="runningHeaderText">PRAGMA</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</h1> <h4> PRAGMA</h4> <p> The <a href="#syntax">PRAGMA command</a> is a special command used to modify the operation of the SQLite library or to query the library for internal (non-table) data. The PRAGMA command is issued using the same interface as other SQLite commands (e.g. SELECT, INSERT) 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. Use with caution! </li> <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> <li>Some pragmas take effect during the SQL compilation stage, not the execution stage. This means if using the C-language sqlite3_compile(), sqlite3_step(), sqlite3_finalize() API (or similar in a wrapper interface), the pragma may be applied to the library during the sqlite3_compile() call. </li> <li>The pragma command is unlikely to be compatible with any other SQL engine. </li> </ul> <p> The available pragmas fall into four basic categories:</p> <ul> <li>Pragmas used to <a href="#schema">query the schema</a> of the current database. </li> <li>Pragmas used to <a href="#modify">modify the operation</a> of the SQLite library in some manner, or to query for the current mode of operation. </li> <li>Pragmas used to <a href="#version">query or modify the databases two version values</a>, the schema-version and the user-version. </li> <li>Pragmas used to <a href="#debug">debug the library</a> and verify that database files are not corrupted. </li> </ul> <hr /> <a name="syntax"></a> <h1> PRAGMA command syntax</h1> <p> <table cellpadding="10"> <tr> <td align="right" valign="top"> <i><font color="#ff3434">sql-statement</font></i> ::=</td> <td> <b><font color="#2c2cf0">PRAGMA </font></b><i><font color="#ff3434">name</font></i><b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">= </font></b><i><font color="#ff3434"> value</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font> </b><big>|</big><b><font color="#2c2cf0"><br /> PRAGMA </font></b><i><font color="#ff3434">function</font></i><b><font color="#2c2cf0"><big>(</big></font></b><i><font color="#ff3434">arg</font></i><b><font color="#2c2cf0"><big>)</big></font></b></td> </tr> </table> </p> <p> The pragmas that take an integer <b><i>value</i></b> also accept symbolic names. The strings "<b>on</b>", "<b>true</b>", and "<b>yes</b>" are equivalent to <b>1</b>. The strings "<b>off</b>", "<b>false</b>", and "<b>no</b>" are equivalent to <b>0</b>. These strings are case- insensitive, and do not require quotes. An unrecognized string will be treated as <b>1</b>, and will not generate an error. When the <i>value</i> is returned it is as an integer.</p> <hr /> <a name="modify"></a> <h1> Pragmas to modify library operation</h1> <ul> <a name="pragma_auto_vacuum"></a> <li> <p> <b>PRAGMA auto_vacuum; <br /> PRAGMA auto_vacuum = </b><i>0 | 1</i><b>;</b></p> <p> Query or set the auto-vacuum flag in the database.</p> <p> Normally, when a transaction that deletes data from a database is committed, the database file remains the same size. Unused database file pages are marked as such and reused later on, when data is inserted into the database. In this mode the <a href="lang_vacuum.html">VACUUM</a> command is used to reclaim unused space.</p> <p> When the auto-vacuum flag is set, the database file shrinks when a transaction that deletes data is committed (The VACUUM command is not useful in a database with the auto-vacuum flag set). To support this functionality the database stores extra information internally, resulting in slightly larger database files than would otherwise be possible.</p> <p> It is only possible to modify the value of the auto-vacuum flag before any tables have been created in the database. No error message is returned if an attempt to modify the auto-vacuum flag is made after one or more tables have been created. </p> <a name="pragma_cache_size"></a></li> <li> <p> <b>PRAGMA cache_size; <br /> PRAGMA cache_size = </b><i>Number-of-pages</i><b>;</b></p> <p> Query or change the maximum number of database disk pages that SQLite will hold in memory at once. Each page uses about 1.5K of memory. The default cache size is 2000. If you are doing UPDATEs or DELETEs that change many rows of a database and you do not mind if SQLite uses more memory, you can increase the cache size for a possible speed improvement.</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. Use the <a href="#pragma_default_cache_size"><b>default_cache_size</b></a> pragma to check the cache size permanently.</p> <a name="pragma_case_sensitive_like"></a></li> <li> <p> <b>PRAGMA case_sensitive_like; <br /> PRAGMA case_sensitive_like = </b><i>0 | 1</i><b>;</b></p> <p> The default behavior of the LIKE operator is to ignore case for latin1 characters. Hence, by default <b>'a' LIKE 'A'</b> is true. The case_sensitive_like pragma can be turned on to change this behavior. When case_sensitive_like is enabled, <b>'a' LIKE 'A'</b> is false but <b>'a' LIKE 'a'</b> is still true.</p> <a name="pragma_count_changes"></a></li> <li> <p> <b>PRAGMA count_changes; <br /> PRAGMA count_changes = </b><i>0 | 1</i><b>;</b></p> <p> Query or change the count-changes flag. Normally, when the count-changes flag is not set, INSERT, UPDATE and DELETE 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.</p> <a name="pragma_default_cache_size"></a></li> <li> <p> <b>PRAGMA default_cache_size; <br /> PRAGMA default_cache_size = </b><i>Number-of-pages</i><b>;</b></p> <p> Query or change the maximum number of database disk pages that SQLite will hold in memory at once. Each page uses 1K on disk and about 1.5K in memory. This pragma works like the <a href="#pragma_cache_size"><b>cache_size</b></a> pragma with the additional feature that it changes the cache size persistently. With this pragma, you can set the cache size once and that setting is retained and reused every time you reopen the database.</p> <a name="pragma_default_synchronous"></a></li> <li> <p> <b>PRAGMA default_synchronous;</b></p> <p> This pragma was available in version 2.8 but was removed in version 3.0. It is a dangerous pragma whose use is discouraged. To help dissuide users of version 2.8 from employing this pragma, the documentation will not tell you what it does.</p> <a name="pragma_empty_result_callbacks"></a></li> <li> <p> <b>PRAGMA empty_result_callbacks; <br /> PRAGMA empty_result_callbacks = </b><i>0 | 1</i><b>;</b></p> <p> Query or change the empty-result-callbacks flag.</p> <p> The empty-result-callbacks flag affects the sqlite3_exec API only. Normally, when the empty-result-callbacks flag is cleared, the callback function supplied to the sqlite3_exec() call 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 sqlite3_exec() API to retrieve column-names even when a query returns no data. </p> <a name="pragma_encoding"></a></li> <li> <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 and subsequent forms of this pragma are only useful if the main database has not already been created. In this case the pragma sets 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". If the second and subsequent forms are used after the database file has already been created, they have no effect and are silently ignored.</p> <p> Once an encoding has been set for a database, it cannot be changed.</p> <p> Databases created by the ATTACH command always use the same encoding as the main database.</p> <a name="pragma_full_column_names"></a></li> <li> <p> <b>PRAGMA full_column_names; <br /> PRAGMA full_column_names = </b><i>0 | 1</i><b>;</b></p> <p> Query or change the full-column-names flag. This flag affects the way SQLite names columns of data returned by SELECT statements when the expression for the column is a table-column name or the wildcard "*". Normally, such result columns are named <table-name/alias><column-name> if the SELECT statement joins two or more tables together, or simply <column-name> if the SELECT statement queries a single table. When the full-column-names flag is set, such columns are always named <table-name/alias> <column-name> regardless of whether or not a join is performed. </p> <p> If both the short-column-names and full-column-names are set, then the behaviour associated with the full-column-names flag is exhibited. </p> <a name="pragma_fullfsync"></a></li> <li> <p> <b>PRAGMA fullfsync <br /> PRAGMA fullfsync = </b><i>0 | 1</i><b>;</b></p> <p> Query or change the fullfsync flag. This flag affects determines whether or not the F_FULLFSYNC syncing method is used on systems that support it. The default value is off. As of this writing (2006-02-10) only Mac OS X supports F_FULLFSYNC. </p> <a name="pragma_legacy_file_format"></a></li> <li> <p> <b>PRAGMA legacy_file_format; <br /> PRAGMA legacy_file_format = <i>ON | OFF</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 to be readable or writable by older versions of SQLite.</p> <p> This flag only effects newly created databases. It has no effect on databases that already exists.</p> <a name="pragma_page_size"></a></li> <li> <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 may only be set if the database has not yet been created. The page size must be a power of two greater than or equal to 512 and less than or equal to 8192. The upper limit may be modified by setting the value of macro SQLITE_MAX_PAGE_SIZE during compilation. The maximum upper bound is 32768. </p> <a name="pragma_read_uncommitted"></a></li> <li> <p> <b>PRAGMA read_uncommitted; <br /> PRAGMA read_uncommitted = </b><i>0 | 1</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="capi3ref.html#sqlite3_enable_shared_cache"> sqlite3_enable_shared_cache()</a> API and is only available between connections running the same thread. Cache sharing is off by default. </p> <a name="pragma_short_column_names"></a></li> <li> <p> <b>PRAGMA short_column_names; <br /> PRAGMA short_column_names = </b><i>0 | 1</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 SELECT statements when the expression for the column is a table-column name or the wildcard "*". Normally, such result columns are named <table-name/alias>lt;column-name> if the SELECT statement joins two or more tables together, or simply <column-name> if the SELECT statement queries a single table. When the short-column-names flag is set, such columns are always named <column-name> regardless of whether or not a join is performed. </p> <p> If both the short-column-names and full-column-names are set, then the behaviour associated with the full-column-names flag is exhibited. </p> <a name="pragma_synchronous"></a></li> <li> <p> <b>PRAGMA synchronous; <br /> PRAGMA synchronous = FULL; </b>(2)<b> <br /> PRAGMA synchronous = NORMAL; </b>(1)<b> <br /> PRAGMA synchronous = OFF; </b>(0)</p> <p> Query or change the setting of the "synchronous" flag. The first (query) form will return the setting as an integer. When synchronous is FULL (2), the SQLite database engine will pause at critical moments to make sure that data has actually been written to the disk surface before continuing. This ensures that if the operating system crashes or if there is a power failure, the database will be uncorrupted after rebooting. FULL synchronous is very safe, but it is also slow. When synchronous is NORMAL, the SQLite database engine will still pause 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 pausing 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 SQLite version 2, the default value is NORMAL. For version 3, the default was changed to FULL. </p> <a name="pragma_temp_store"></a></li> <li> <p> <b>PRAGMA temp_store; <br /> PRAGMA temp_store = DEFAULT;</b> (0)<b> <br /> PRAGMA temp_store = FILE;</b> (1)<b> <br /> PRAGMA temp_store = MEMORY;</b> (2)</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 TEMP_STORE is used to determine where temporary tables and indices are stored. When temp_store is MEMORY (2) temporary tables and indices are kept in memory. When temp_store is FILE (1) temporary tables and indices are stored in a file. The <a href="#pragma_temp_store_directory">temp_store_directory</a> pragma can be used to specify the directory containing this file. <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 TEMP_STORE to override this pragma setting. The following table summarizes the interaction of the TEMP_STORE preprocessor macro and the temp_store pragma:</p> <blockquote> <table border="1" cellpadding="2"> <tr> <th valign="bottom"> TEMP_STORE</th> <th valign="bottom"> PRAGMA<br /> temp_store</th> <th> Storage used for<br /> TEMP tables and indices</th> </tr> <tr> <td align="middle"> 0</td> <td align="middle"> <em>any</em></td> <td align="middle"> file</td> </tr> <tr> <td align="middle"> 1</td> <td align="middle"> 0</td> <td align="middle"> file</td> </tr> <tr> <td align="middle"> 1</td> <td align="middle"> 1</td> <td align="middle"> file</td> </tr> <tr> <td align="middle"> 1</td> <td align="middle"> 2</td> <td align="middle"> memory</td> </tr> <tr> <td align="middle"> 2</td> <td align="middle"> 0</td> <td align="middle"> memory</td> </tr> <tr> <td align="middle"> 2</td> <td align="middle"> 1</td> <td align="middle"> file</td> </tr> <tr> <td align="middle"> 2</td> <td align="middle"> 2</td> <td align="middle"> memory</td> </tr> <tr> <td align="middle"> 3</td> <td align="middle"> <em>any</em></td> <td align="middle"> memory</td> </tr> </table> </blockquote> <br /> <a name="pragma_temp_store_directory"></a></li> <li> <p> <b>PRAGMA temp_store_directory; <br /> PRAGMA temp_store_directory = 'directory-name';</b></p> <p> Query or change the setting of the "temp_store_directory" - the directory where files used for storing temporary tables and indices are kept. This setting lasts for the duration of the current connection only and resets to its default value for each new connection opened. </p> <p> When the temp_store_directory setting is changed, all existing temporary tables, indices, triggers, and viewers are immediately deleted. In practice, temp_store_directory should be set immediately after the database is opened. </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. For Unix/Linux/OSX, the default is the is the first writable directory found in the list of: <b>/var/tmp, /usr/tmp, /tmp,</b> and <b><i>current-directory</i></b>. For Windows NT, the default directory is determined by Windows, generally <b>C:\Documents and Settings\<i>user-name</i>\Local Settings\Temp\</b>. Temporary files created by SQLite are unlinked immediately after opening, so that the operating system can automatically delete the files when the SQLite process exits. Thus, temporary files are not normally visible through <i>ls</i> or <i>dir</i> commands.</p> </li> </ul> <hr /> <a name="schema"></a> <h1> Pragmas to query the database schema</h1> <ul> <a name="pragma_database_list"></a> <li> <p> <b>PRAGMA database_list;</b></p> <p> For each open database, invoke the callback function once with information about that database. Arguments include the index and the name the database was attached with. The first row will be for the main database. The second row will be for the database used to store temporary tables.</p> <a name="pragma_foreign_key_list"></a></li> <li> <p> <b>PRAGMA foreign_key_list(</b><i>table-name</i><b>);</b></p> <p> For each foreign key that references a column in the argument table, invoke the callback function with information about that foreign key. The callback function will be invoked once for each column in each foreign key.</p> <a name="pragma_index_info"></a></li> <li> <p> <b>PRAGMA index_info(</b><i>index-name</i><b>);</b></p> <p> For each column that the named index references, invoke the callback function once with information about that column, including the column name, and the column number.</p> <a name="pragma_index_list"></a></li> <li> <p> <b>PRAGMA index_list(</b><i>table-name</i><b>);</b></p> <p> For each index on the named table, invoke the callback function once with information about that index. Arguments include the index name and a flag to indicate whether or not the index must be unique.</p> <a name="pragma_table_info"></a></li> <li> <p> <b>PRAGMA table_info(</b><i>table-name</i><b>);</b></p> <p> For each column in the named table, invoke the callback function once with information about that column, including the column name, data type, whether or not the column can be NULL, and the default value for the column.</p> </li> </ul> <hr /> <a name="version"></a> <h1> Pragmas to query/modify version values</h1> <ul> <a name="pragma_schema_version"></a><a name="pragma_user_version"></a> <li> <p> <b>PRAGMA [database.]schema_version; <br /> PRAGMA [database.]schema_version = </b><i>integer </i><b>; <br /> PRAGMA [database.]user_version; <br /> PRAGMA [database.]user_version = </b><i>integer </i><b>;</b> </p> <p> The pragmas schema_version and user_version are used to set or get the value of the schema-version and user-version, respectively. Both the schema-version and the user-version are 32-bit signed integers stored in the database header.</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> </li> </ul> <hr /> <a name="debug"></a> <h1> Pragmas to debug the library</h1> <ul> <a name="pragma_integrity_check"></a> <li> <p> <b>PRAGMA integrity_check;</b></p> <p> The command does an integrity check of the entire database. It looks for out-of-order records, missing pages, malformed records, and corrupt indices. If any problems are found, then a single string is returned which is a description of all problems. If everything is in order, "ok" is returned.</p> <a name="pragma_parser_trace"></a></li> <li> <p> <b>PRAGMA parser_trace = ON; </b>(1)<b> <br /> PRAGMA parser_trace = OFF;</b> (0)</p> <p> Turn tracing of the SQL parser inside of the SQLite library on and off. This is used for debugging. This only works if the library is compiled without the NDEBUG macro. </p> <a name="pragma_vdbe_trace"></a></li> <li> <p> <b>PRAGMA vdbe_trace = ON; </b>(1)<b> <br /> PRAGMA vdbe_trace = OFF;</b> (0)</p> <p> Turn tracing of the virtual database engine inside of the SQLite library on and off. This is used for debugging. See the <a href="vdbe.html#trace">VDBE documentation</a> for more information.</p> <a name="pragma_vdbe_listing"></a></li> <li> <p> <b>PRAGMA vdbe_listing = ON; </b>(1)<b> <br /> PRAGMA vdbe_listing = OFF;</b> (0)</p> <p> Turn listings of virtual machine programs on and off. With listing is on, the entire content of a program is printed just prior to beginning execution. This is like automatically executing an EXPLAIN prior to each statement. The statement executes normally after the listing is printed. This is used for debugging. See the <a href="vdbe.html#trace"> VDBE documentation</a> for more information.</p> </li> </ul> <p> <hr> </p> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |
Added Doc/Extra/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 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 | <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="ndoc.css"> </link> <link rel="stylesheet" type="text/css" href="user.css"> </link> <script type="text/javascript" src="ndoc.js"> </script> </head> <body style="display: none;"> <input type="hidden" id="userDataCache" class="userDataStyle" /> <input type="hidden" id="hiddenScrollOffset" /> <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" /> <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" /> <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" /> <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" /> <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" /> <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" /> <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" /> <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" /> <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 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> SQLite implements the follow syntax:</h4> <p> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"> <tr> <td> <a href="lang_altertable.html"> ALTER TABLE</a></td> </tr> <tr> <td> <a href="lang_analyze.html"> ANALYZE</a></td> </tr> <tr> <td style="height: 19px"> <a href="lang_attach.html"> ATTACH DATABASE</a></td> </tr> <tr> <td> <a href="lang_transaction.html"> BEGIN TRANSACTION</a></td> </tr> <tr> <td> <a href="lang_comment.html"> comment</a></td> </tr> <tr> <td> <a href="lang_transaction.html"> COMMIT TRANSACTION</a></td> </tr> <tr> <td> <a href="lang_createindex.html">CREATE INDEX</a></td> </tr> <tr> <td> <a href="lang_createtable.html">CREATE TABLE</a></td> </tr> <tr> <td> <a href="lang_createtrigger.html">CREATE TRIGGER</a></td> </tr> <tr> <td> <a href="lang_createview.html">CREATE VIEW</a></td> </tr> <tr> <td> <a href="lang_createvtab.html"> CREATE VIRTUAL TABLE</a></td> </tr> <tr> <td> <a href="lang_delete.html"> DELETE</a></td> </tr> <tr> <td> <a href="lang_detach.html"> DETACH DATABASE</a></td> </tr> <tr> <td> <a href="lang_dropindex.html">DROP INDEX</a></td> </tr> <tr> <td> <a href="lang_droptable.html">DROP TABLE</a></td> </tr> <tr> <td> <a href="lang_droptrigger.html">DROP TRIGGER</a></td> </tr> <tr> <td> <a href="lang_dropview.html">DROP VIEW</a></td> </tr> <tr> <td> <a href="lang_transaction.html"> END TRANSACTION</a></td> </tr> <tr> <td> <a href="lang_explain.html"> EXPLAIN</a></td> </tr> <tr> <td> <a href="lang_expr.html"> expression</a></td> </tr> <tr> <td> <a href="lang_insert.html"> INSERT</a></td> </tr> <tr> <td> <a href="lang_conflict.html"> ON CONFLICT clause</a></td> </tr> <tr> <td style="height: 19px"> <a href="pragma.html"> PRAGMA</a></td> </tr> <tr> <td> <a href="lang_reindex.html"> REINDEX</a></td> </tr> <tr> <td> <a href="lang_replace.html"> REPLACE</a></td> </tr> <tr> <td> <a href="lang_transaction.html"> ROLLBACK TRANSACTION</a></td> </tr> <tr> <td> <a href="lang_select.html"> SELECT</a></td> </tr> <tr> <td> <a href="lang_update.html"> UPDATE</a></td> </tr> <tr> <td> <a href="lang_vacuum.html"> VACUUM</a></td> </tr> </table> </p> <hr> <div id="footer"> <p> </p> <p> </p> </div> </div> </div> </body> </html> |