Index: Doc/Extra/Core/lang.html ================================================================== --- Doc/Extra/Core/lang.html +++ Doc/Extra/Core/lang.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_aggfunc.html ================================================================== --- Doc/Extra/Core/lang_aggfunc.html +++ Doc/Extra/Core/lang_aggfunc.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_altertable.html ================================================================== --- Doc/Extra/Core/lang_altertable.html +++ Doc/Extra/Core/lang_altertable.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_analyze.html ================================================================== --- Doc/Extra/Core/lang_analyze.html +++ Doc/Extra/Core/lang_analyze.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_attach.html ================================================================== --- Doc/Extra/Core/lang_attach.html +++ Doc/Extra/Core/lang_attach.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_comment.html ================================================================== --- Doc/Extra/Core/lang_comment.html +++ Doc/Extra/Core/lang_comment.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_conflict.html ================================================================== --- Doc/Extra/Core/lang_conflict.html +++ Doc/Extra/Core/lang_conflict.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_corefunc.html ================================================================== --- Doc/Extra/Core/lang_corefunc.html +++ Doc/Extra/Core/lang_corefunc.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_createindex.html ================================================================== --- Doc/Extra/Core/lang_createindex.html +++ Doc/Extra/Core/lang_createindex.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_createtable.html ================================================================== --- Doc/Extra/Core/lang_createtable.html +++ Doc/Extra/Core/lang_createtable.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_createtrigger.html ================================================================== --- Doc/Extra/Core/lang_createtrigger.html +++ Doc/Extra/Core/lang_createtrigger.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_createview.html ================================================================== --- Doc/Extra/Core/lang_createview.html +++ Doc/Extra/Core/lang_createview.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_createvtab.html ================================================================== --- Doc/Extra/Core/lang_createvtab.html +++ Doc/Extra/Core/lang_createvtab.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_datefunc.html ================================================================== --- Doc/Extra/Core/lang_datefunc.html +++ Doc/Extra/Core/lang_datefunc.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); @@ -266,12 +266,12 @@ number of seconds since 1970. If the "unixepoch" modifier does not follow a timestring of the form DDDDDDDDDD which expresses the number of seconds since 1970 or if other modifiers separate the "unixepoch" modifier from prior DDDDDDDDDD then the behavior is undefined. -Due to precision limitations imposed by the implementations use -of 64-bit integers, the "unixepoch" modifier only works for +For SQLite versions before 3.16.0 (2017-01-02), +the "unixepoch" modifier only works for dates between 0000-01-01 00:00:00 and 5352-11-01 10:52:47 (unix times of -62167219200 through 106751991167).

Index: Doc/Extra/Core/lang_delete.html ================================================================== --- Doc/Extra/Core/lang_delete.html +++ Doc/Extra/Core/lang_delete.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_detach.html ================================================================== --- Doc/Extra/Core/lang_detach.html +++ Doc/Extra/Core/lang_detach.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_dropindex.html ================================================================== --- Doc/Extra/Core/lang_dropindex.html +++ Doc/Extra/Core/lang_dropindex.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_droptable.html ================================================================== --- Doc/Extra/Core/lang_droptable.html +++ Doc/Extra/Core/lang_droptable.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_droptrigger.html ================================================================== --- Doc/Extra/Core/lang_droptrigger.html +++ Doc/Extra/Core/lang_droptrigger.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_dropview.html ================================================================== --- Doc/Extra/Core/lang_dropview.html +++ Doc/Extra/Core/lang_dropview.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_explain.html ================================================================== --- Doc/Extra/Core/lang_explain.html +++ Doc/Extra/Core/lang_explain.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_expr.html ================================================================== --- Doc/Extra/Core/lang_expr.html +++ Doc/Extra/Core/lang_expr.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); @@ -481,19 +481,24 @@

The IN and NOT IN operators

-

The IN and NOT IN operators take a single scalar operand on the -left and a vector operand on the right -formed by an explicit list of zero or more scalars or by a -single subquery. +

The IN and NOT IN operators take an expression on the +left and a list of values or a subquery on the right. When the right operand of an IN or NOT IN operator is a subquery, the -subquery must have a single result column. -The "subquery" on the right-hand side of an IN operator can be a -table name or table-valued function name in which case the -subquery is understood to be "(SELECT * FROM name)". +subquery must have the same number of columns as there are columns in +the row value of the left operand. The subquery on the +right of an IN or NOT IN operator must be a scalar subquery if the left +expression is not a row value expression. +If the right operand of an IN or NOT IN operator is a list of values, +each of those values must be scalars and the left expression must also +be a scalar. +The right-hand side of an IN or NOT IN operator can be a +table name or table-valued function name in which +case the right-hand side is understood to be subquery of +the form "(SELECT * FROM name)". When the right operand is an empty set, the result of IN is false and the result of NOT IN is true, regardless of the left operand and even if the left operand is NULL.

The result of an IN or NOT IN operator is determined by the following matrix: @@ -548,10 +553,23 @@

Note that SQLite allows the parenthesized list of scalar values on the right-hand side of an IN or NOT IN operator to be an empty list but most other SQL database database engines and the SQL92 standard require the list to contain at least one element.

+

Table Column Names

+ +

A column name can be any of the names defined in the CREATE TABLE +statement or one of the following special identifiers: "ROWID", +"OID", or "_ROWID_". +The three special identifiers describe the +unique integer key (the rowid) associated with every +row of every table and so are not available on WITHOUT ROWID tables. +The special identifiers only refer to the row key if the CREATE TABLE +statement does not define a real column with the same name. +The rowid can be used anywhere a regular +column can be used.

+

The EXISTS operator

The EXISTS operator always evaluates to one of the integer values 0 @@ -565,37 +583,27 @@ of the EXISTS operator. In particular, rows containing NULL values are not handled any differently from rows without NULL values. -

Scalar Subqueries

- -

A SELECT statement enclosed in parentheses may appear as a scalar -quantity. A SELECT used as a scalar quantity must return a result set -with a single column. The result of the expression is the value of the -only column in the first row returned by the SELECT statement. If the SELECT -yields more than one result row, all rows after the first are ignored. If -the SELECT yields no rows, then the value of the expression is NULL. -The LIMIT of a scalar subquery is always 1. -Any other LIMIT value given in the SQL text is ignored. - -

All types of SELECT statement, including aggregate and compound SELECT -queries (queries with keywords like UNION or EXCEPT) are allowed as scalar -subqueries. - -

Table Column Names

- -

A column name can be any of the names defined in the CREATE TABLE -statement or one of the following special identifiers: "ROWID", -"OID", or "_ROWID_". -The three special identifiers describe the -unique integer key (the rowid) associated with every -row of every table and so are not available on WITHOUT ROWID tables. -The special identifiers only refer to the row key if the CREATE TABLE -statement does not define a real column with the same name. -The rowid can be used anywhere a regular -column can be used.

+

Subquery Expressions

+ +

A SELECT statement enclosed in parentheses is a subquery. +All types of SELECT statement, including +aggregate and compound SELECT queries (queries with keywords like +UNION or EXCEPT) are allowed as scalar subqueries. +The value of a subquery expression is the first row of the result +from the enclosed SELECT statement. +In other words, an implied "LIMIT 1" is added to the subquery, overriding +an explicitly coded LIMIT. +The value of a subquery expression is NULL if the enclosed +SELECT statement returns no rows. + +

A subquery that returns a single column is a scalar subquery and can +be used most anywhere. +A subquery that returns two or more columns is a row value +subquery and can only be used as the operand of a comparison operator.

Correlated Subqueries

Index: Doc/Extra/Core/lang_indexedby.html ================================================================== --- Doc/Extra/Core/lang_indexedby.html +++ Doc/Extra/Core/lang_indexedby.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_insert.html ================================================================== --- Doc/Extra/Core/lang_insert.html +++ Doc/Extra/Core/lang_insert.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_keywords.html ================================================================== --- Doc/Extra/Core/lang_keywords.html +++ Doc/Extra/Core/lang_keywords.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_naming.html ================================================================== --- Doc/Extra/Core/lang_naming.html +++ Doc/Extra/Core/lang_naming.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_reindex.html ================================================================== --- Doc/Extra/Core/lang_reindex.html +++ Doc/Extra/Core/lang_reindex.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_replace.html ================================================================== --- Doc/Extra/Core/lang_replace.html +++ Doc/Extra/Core/lang_replace.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_savepoint.html ================================================================== --- Doc/Extra/Core/lang_savepoint.html +++ Doc/Extra/Core/lang_savepoint.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_select.html ================================================================== --- Doc/Extra/Core/lang_select.html +++ Doc/Extra/Core/lang_select.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); @@ -516,11 +516,11 @@ M=0).

If a FROM clause is specified, the data on which a simple SELECT query operates comes from the one or more tables or subqueries (SELECT statements in parenthesis) specified following the FROM keyword. A subquery specified -in the table-or-subquery following the FROM clause in a +in the table-or-subquery following the FROM clause in a simple SELECT statement is handled as if it was a table containing the data returned by executing the subquery statement. Each column of the subquery has the collation sequence and affinity of the corresponding expression in the subquery statement. @@ -721,10 +721,50 @@ set of result rows. Subject to filtering associated with the DISTINCT keyword, the number of rows returned by an aggregate query with a GROUP BY clause is the same as the number of groups of rows produced by applying the GROUP BY and HAVING clauses to the filtered input dataset. + + + +

Side note: Bare columns in an aggregate queries. +The usual case is that all column names in an aggregate query are either +arguments to aggregate functions or else appear in the GROUP BY clause. +A result column which contains a column name that is not within an +aggregate function and that does not appear in the GROUP BY clause (if +one exists) is called a "bare" column. +Example: +

+SELECT a, b, sum(c) FROM tab1 GROUP BY a;
+
+

In the query above, the "a" column is part of the GROUP BY clause +and so each row of the output contains one of the distinct values for +"a". The "c" column is contained within the sum() aggregate function +and so that output column is the sum of all "c" values in rows that +have the same value for "a". But what is the result of the bare +column "b"? The answer is that the "b" result will be the +value for "b" in one of the input rows that form the aggregate. +The problem is that you usually do not know which input row is used +to compute "b", and so in many cases the value for "b" is undefined. +

+

+Special processing occurs occurs when the aggregate function is +either min() or max(). Example: +

+SELECT a, b, max(c) FROM tab1 GROUP BY a;
+
+When the min() or max() aggregate functions +are used in an aggregate query, all bare columns in the result set +take values from the input +row which also contains the minimum or maximum. So in the query +above, the value of the "b" column in the output will be the value of +the "b" column in the input row that has the largest "c" value. +There is still an ambiguity if two or more of the input rows have the +same minimum or maximum value or if the query contains more than one +min() and/or max() aggregate function. Only the built-in min() +and max() functions work this way. +

4. Removal of duplicate rows (DISTINCT processing). @@ -734,12 +774,12 @@ entire set of result rows are returned by the SELECT. If neither ALL or DISTINCT are present, then the behavior is as if ALL were specified. If the simple SELECT is a SELECT DISTINCT, then duplicate rows are removed from the set of result rows before it is returned. For the purposes of detecting duplicate rows, two NULL values are considered to be equal. The -normal rules for selecting a collation sequence to compare text values with -apply. +usual rules apply for selecting a collation +sequence to compare text values.

Compound Select Statements

Index: Doc/Extra/Core/lang_transaction.html ================================================================== --- Doc/Extra/Core/lang_transaction.html +++ Doc/Extra/Core/lang_transaction.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_update.html ================================================================== --- Doc/Extra/Core/lang_update.html +++ Doc/Extra/Core/lang_update.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_vacuum.html ================================================================== --- Doc/Extra/Core/lang_vacuum.html +++ Doc/Extra/Core/lang_vacuum.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/lang_with.html ================================================================== --- Doc/Extra/Core/lang_with.html +++ Doc/Extra/Core/lang_with.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); Index: Doc/Extra/Core/pragma.html ================================================================== --- Doc/Extra/Core/pragma.html +++ Doc/Extra/Core/pragma.html @@ -55,11 +55,11 @@ } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ -if( !location.origin.match(/http/) ){ +if( !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); @@ -99,12 +99,12 @@ not during the sqlite3_step() call as normal SQL statements do. Or the pragma might run during sqlite3_step() just like normal SQL statements. Whether or not the pragma runs during sqlite3_prepare() or sqlite3_step() depends on the pragma and on the specific release of SQLite. -
  • The pragma command is specific to SQLite and is very unlikely - to be compatible with any other SQL database engine. +
  • The pragma command is specific to SQLite and is + not compatible with any other SQL database engine.

    The C-language API for SQLite provides the SQLITE_FCNTL_PRAGMA file control which gives VFS implementations the opportunity to add new PRAGMA statements or to override the meaning of @@ -157,10 +157,79 @@ name is meaningless and is simply ignored. In the documentation below, pragmas for which the schema name is meaningful are shown with a "schema." prefix.

    +
    +

    PRAGMA functions

    + + +

    +PRAGMAs that return results and that have no side-effects can be +accessed from ordinary SELECT statements as table-valued functions. +For each participating PRAGMA, the corresponding table-valued function +has the same name as the PRAGMA with a 7-character "pragma_" prefix. +The PRAGMA argument and schema, if any, are passed as arguments to +the table-valued function. + +

    For example, information about the columns in an index can be +read using the index_info pragma as follows: + +

    +PRAGMA index_info('idx52');
    +
    + +

    Or, the same content can be read using: + +

    +SELECT * FROM pragma_index_info('idx52');
    +
    + +

    The advantage of the table-valued function format is that the query +can return just a subset of the PRAGMA columns, can include a WHERE clause, +can use aggregate functions, and the table-valued function can be just +one of several data sources in a join. +For example, to get a list of all indexed columns in a schema, one +could query: + +

    +SELECT DISTINCT m.name || '.' || ii.name AS 'indexed-columns'
    +  FROM sqlite_master AS m,
    +       pragma_index_list(m.name) AS il,
    +       pragma_index_info(il.name) AS ii
    + WHERE m.type='table'
    + ORDER BY 1;
    +
    + +

    +Additional notes: +


    List Of PRAGMAs