⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lang_select.html

📁 这是sqlite3.56的文档。拿来给大家阅读使用
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>SQLite Query Language: SELECT</title><style type="text/css">body {    margin: auto;    font-family: "Verdana" "sans-serif";    padding: 8px 1%;}a { color: #45735f }a:visited { color: #734559 }.logo { position:absolute; margin:3px; }.tagline {  float:right;  text-align:right;  font-style:italic;  width:240px;  margin:12px;  margin-top:58px;}.toolbar {  font-variant: small-caps;  text-align: center;  line-height: 1.6em;  margin: 0;  padding:1px 8px;}.toolbar a { color: white; text-decoration: none; padding: 6px 12px; }.toolbar a:visited { color: white; }.toolbar a:hover { color: #80a796; background: white; }.content    { margin: 5%; }.content dt { font-weight:bold; }.content dd { margin-bottom: 25px; margin-left:20%; }.content ul { padding:0px; padding-left: 15px; margin:0px; }/* rounded corners */.se  { background: url(images/se.png) 100% 100% no-repeat #80a796}.sw  { background: url(images/sw.png) 0% 100% no-repeat }.ne  { background: url(images/ne.png) 100% 0% no-repeat }.nw  { background: url(images/nw.png) 0% 0% no-repeat }</style><meta http-equiv="content-type" content="text/html; charset=UTF-8">  </head><body><div><!-- container div to satisfy validator --><a href="index.html"><img class="logo" src="images/SQLite.gif" alt="SQLite Logo" border="0"></a><div><!-- IE hack to prevent disappearing logo--></div><div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div><table width=100% style="clear:both"><tr><td>  <div class="se"><div class="sw"><div class="ne"><div class="nw">  <div class="toolbar">    <a href="about.html">About</a>    <a href="sitemap.html">Sitemap</a>    <a href="docs.html">Documentation</a>    <a href="download.html">Download</a>    <a href="copyright.html">License</a>    <a href="news.html">News</a>    <a href="http://www.sqlite.org/cvstrac/index">Developers</a>    <a href="support.html">Support</a>  </div></div></div></div></div></td></tr></table>  <a href="lang.html"><h2>SQL As Understood By SQLite</h2></a><h3>SELECT</h3><table cellpadding="10"><tr><td align="right" valign="top"><i><font color="#ff3434">sql-statement</font></i>&nbsp;::=</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>&nbsp;::=</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>&nbsp;::=</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>&nbsp;::=</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>&nbsp;::=</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>&nbsp;::=</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>&nbsp;::=</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>&nbsp;::=</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>&nbsp;::=</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>&nbsp;::=</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>The SELECT statement is used to query the database.  Theresult of a SELECT is zero or more rows of data where each rowhas a fixed number of columns.  The number of columns in theresult is specified by the expression list in between theSELECT and FROM keywords.  Any arbitrary expression can be usedas a result.  If a result expression is <font color="#2c2cf0"><big>*</big></font> then all columns of all tables are substitutedfor that one expression.  If the expression is the name ofa table followed by <font color="#2c2cf0"><big>.*</big></font> then the result is all columnsin 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 afterthe 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-queryin 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 asingle row consisting of the values of the expression list.</p><p>The WHERE clause can be used to limit the number of rows overwhich the query operates.</p><p>The GROUP BY clauses causes one or more rows of the result tobe combined into a single row of output.  This is especially usefulwhen the result contains aggregate functions.  The expressions inthe GROUP BY clause do <em>not</em> have to be expressions thatappear in the result.  The HAVING clause is similar to WHERE exceptthat HAVING applies after grouping has occurred.  The HAVING expressionmay 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 thekey for the sort.  The expressions do not have to be part of theresult for a simple SELECT, but in a compound SELECT each sortexpression must exactly match one of the result columns.  Eachsort expression may be optionally followed by a COLLATE keyword andthe name of a collating function used for ordering text and/orkeywords ASC or DESC to specify the sort order.</p><p>Each term of an ORDER BY expression is processed as follows:</p><ol><li><p>If the ORDER BY expression is a constant integer K then theoutput is ordered by the K-th column of the result set.</p></li><li><p>If the ORDER BY expression is an identifier and one of theoutput columns as an alias by the same name, then the output isordered by the identified column.</p></li><li><p>Otherwise, the ORDER BY expression is evaluated and the output is ordered by the value of that expression.</p></li></ol><p>In a compound SELECT statement, the third ORDER BY matching rulerequires that the expression be identical to one of the columns inthe result set.  The three rules are first applied to the left-mostSELECT in the compound.  If a match is found, the search stops.  Otherwise,the next SELECT to the right is tried.  This continues until a matchis found.  Each term of the ORDER BY clause is processed separately and may come from different SELECT statements in the compound.</p><p>The LIMIT clause places an upper bound on the number of rowsreturned in the result.  A negative LIMIT indicates no upper bound.The optional OFFSET following LIMIT specifies how manyrows to skip at the beginning of the result set.In a compound query, the LIMIT clause may only appear on thefinal SELECT statement.The limit is applied to the entire query notto the individual SELECT statement to which it is attached.Note that if the OFFSET keyword is used in the LIMIT clause, then thelimit is the first number and the offset is the second number.  If acomma is used instead of the OFFSET keyword, then the offset is thefirst number and the limit is the second number.  This seemingcontradition is intentional - it maximizes compatibility with legacySQL database systems.</p><p>A compound SELECT is formed from two or more simple SELECTs connectedby one of the operators UNION, UNION ALL, INTERSECT, or EXCEPT.  Ina compound SELECT, all the constituent SELECTs must specify thesame number of result columns.  There may be only a single ORDER BYclause at the end of the compound SELECT.  The UNION and UNION ALLoperators combine the results of the SELECTs to the right and left intoa single big table.  The difference is that in UNION all result rowsare distinct where in UNION ALL there may be duplicates.The INTERSECT operator takes the intersection of the results of theleft and right SELECTs.  EXCEPT takes the result of left SELECT afterremoving the results of the right SELECT.  When three or more SELECTsare connected into a compound, they group from left to right.</p><hr><small<i>This page last modified 2007/12/20 21:09:25 UTC</i></small></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -