<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>SQLite Query Language: SQLite Keywords</title>
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_div("searchmenu")'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='docs.html'>Documentation</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<span class="desktoponly">Search for:</span> <input type="text" name="q">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
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/) ){
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);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
</script>
</div>
<div class=nosearch><h1 align="center">SQL As Understood By SQLite</h1><p><a href="lang.html">[Top]</a></p><h2>SQLite Keywords</h2></div></DIV>

<p>The SQL standard specifies a huge number of keywords which may not
be used as the names of tables, indices, columns, databases, user-defined
functions, collations, virtual table modules, or any other named object.
The list of keywords is so long that few people can remember them all.
For most SQL code, your safest bet is to never use any English language
word as the name of a user-defined object.</p>

<p>If you want to use a keyword as a name, you need to quote it.  There
are four ways of quoting keywords in SQLite:</p>

<p>
<blockquote>
<table>
<tr>	<td valign="top"><b>'keyword'</b></td><td width="20"></td>
	<td>A keyword in single quotes is a string literal.</td></tr>

<tr>	<td valign="top"><b>"keyword"</b></td><td></td>
	<td>A keyword in double-quotes is an identifier.</td></tr>

<tr>	<td valign="top"><b>&#91;keyword&#93;</b></td><td></td>
	<td>A keyword enclosed in square brackets is 
        an identifier.  This is not standard SQL.  This quoting mechanism
        is used by MS Access and SQL Server and is included in SQLite for
        compatibility.</td></tr>

<tr>	<td valign="top"><b>&#96;keyword&#96;</b></td><td></td>
	<td>A keyword enclosed in grave accents (ASCII code 96) is 
        an identifier.  This is not standard SQL.  This quoting mechanism
        is used by MySQL and is included in SQLite for
        compatibility.</td></tr>
</table>
</blockquote>
</p>

<p>For resilience when confronted with historical SQL statements, SQLite
will sometimes bend the quoting rules above:</p>

<ul>
<li><p>If a keyword in single
quotes (ex: <b>'key'</b> or <b>'glob'</b>) is used in a context where
an identifier is allowed but where a string literal is not allowed, then
the token is understood to be an identifier instead of a string literal.
</p></li>

<li><p>If a keyword in double
quotes (ex: <b>"key"</b> or <b>"glob"</b>) is used in a context where
it cannot be resolved to an identifier but where a string literal
is allowed, then the token is understood to be a string literal instead
of an identifier.</p></li>
</ul>

<p>Programmers are cautioned not to use the two exceptions described in
the previous bullets.  We emphasize that they exist only so that old
and ill-formed SQL statements will run correctly.  Future versions of
SQLite might raise errors instead of accepting the malformed
statements covered by the exceptions above.</p>

<p>
SQLite adds new keywords from time to time when it takes on new features.
So to prevent your code from being broken by future enhancements, you should
normally quote any identifier that is an English language word, even if
you do not have to.
</p>

<p>
The list below shows all possible keywords used by any build of
SQLite regardless of <a href="compile.html">compile-time options</a>.  
Most reasonable configurations use most or all of these keywords,
but some keywords may be omitted when SQL language features are
disabled.
Regardless of the compile-time configuration, any identifier that is not on
the following 124 element
list is not a keyword to the SQL parser in SQLite:
</p>

<style>
#listtab29 tr td {vertical-align:top;}
</style>
<table id='listtab29' width='100%'></table>
<script>
var listitems29 = [{"u":"","x":"ABORT","s":0},
{"u":"","x":"ACTION","s":0},
{"u":"","x":"ADD","s":0},
{"u":"","x":"AFTER","s":0},
{"u":"","x":"ALL","s":0},
{"u":"","x":"ALTER","s":0},
{"u":"","x":"ANALYZE","s":0},
{"u":"","x":"AND","s":0},
{"u":"","x":"AS","s":0},
{"u":"","x":"ASC","s":0},
{"u":"","x":"ATTACH","s":0},
{"u":"","x":"AUTOINCREMENT","s":0},
{"u":"","x":"BEFORE","s":0},
{"u":"","x":"BEGIN","s":0},
{"u":"","x":"BETWEEN","s":0},
{"u":"","x":"BY","s":0},
{"u":"","x":"CASCADE","s":0},
{"u":"","x":"CASE","s":0},
{"u":"","x":"CAST","s":0},
{"u":"","x":"CHECK","s":0},
{"u":"","x":"COLLATE","s":0},
{"u":"","x":"COLUMN","s":0},
{"u":"","x":"COMMIT","s":0},
{"u":"","x":"CONFLICT","s":0},
{"u":"","x":"CONSTRAINT","s":0},
{"u":"","x":"CREATE","s":0},
{"u":"","x":"CROSS","s":0},
{"u":"","x":"CURRENT_DATE","s":0},
{"u":"","x":"CURRENT_TIME","s":0},
{"u":"","x":"CURRENT_TIMESTAMP","s":0},
{"u":"","x":"DATABASE","s":0},
{"u":"","x":"DEFAULT","s":0},
{"u":"","x":"DEFERRABLE","s":0},
{"u":"","x":"DEFERRED","s":0},
{"u":"","x":"DELETE","s":0},
{"u":"","x":"DESC","s":0},
{"u":"","x":"DETACH","s":0},
{"u":"","x":"DISTINCT","s":0},
{"u":"","x":"DROP","s":0},
{"u":"","x":"EACH","s":0},
{"u":"","x":"ELSE","s":0},
{"u":"","x":"END","s":0},
{"u":"","x":"ESCAPE","s":0},
{"u":"","x":"EXCEPT","s":0},
{"u":"","x":"EXCLUSIVE","s":0},
{"u":"","x":"EXISTS","s":0},
{"u":"","x":"EXPLAIN","s":0},
{"u":"","x":"FAIL","s":0},
{"u":"","x":"FOR","s":0},
{"u":"","x":"FOREIGN","s":0},
{"u":"","x":"FROM","s":0},
{"u":"","x":"FULL","s":0},
{"u":"","x":"GLOB","s":0},
{"u":"","x":"GROUP","s":0},
{"u":"","x":"HAVING","s":0},
{"u":"","x":"IF","s":0},
{"u":"","x":"IGNORE","s":0},
{"u":"","x":"IMMEDIATE","s":0},
{"u":"","x":"IN","s":0},
{"u":"","x":"INDEX","s":0},
{"u":"","x":"INDEXED","s":0},
{"u":"","x":"INITIALLY","s":0},
{"u":"","x":"INNER","s":0},
{"u":"","x":"INSERT","s":0},
{"u":"","x":"INSTEAD","s":0},
{"u":"","x":"INTERSECT","s":0},
{"u":"","x":"INTO","s":0},
{"u":"","x":"IS","s":0},
{"u":"","x":"ISNULL","s":0},
{"u":"","x":"JOIN","s":0},
{"u":"","x":"KEY","s":0},
{"u":"","x":"LEFT","s":0},
{"u":"","x":"LIKE","s":0},
{"u":"","x":"LIMIT","s":0},
{"u":"","x":"MATCH","s":0},
{"u":"","x":"NATURAL","s":0},
{"u":"","x":"NO","s":0},
{"u":"","x":"NOT","s":0},
{"u":"","x":"NOTNULL","s":0},
{"u":"","x":"NULL","s":0},
{"u":"","x":"OF","s":0},
{"u":"","x":"OFFSET","s":0},
{"u":"","x":"ON","s":0},
{"u":"","x":"OR","s":0},
{"u":"","x":"ORDER","s":0},
{"u":"","x":"OUTER","s":0},
{"u":"","x":"PLAN","s":0},
{"u":"","x":"PRAGMA","s":0},
{"u":"","x":"PRIMARY","s":0},
{"u":"","x":"QUERY","s":0},
{"u":"","x":"RAISE","s":0},
{"u":"","x":"RECURSIVE","s":0},
{"u":"","x":"REFERENCES","s":0},
{"u":"","x":"REGEXP","s":0},
{"u":"","x":"REINDEX","s":0},
{"u":"","x":"RELEASE","s":0},
{"u":"","x":"RENAME","s":0},
{"u":"","x":"REPLACE","s":0},
{"u":"","x":"RESTRICT","s":0},
{"u":"","x":"RIGHT","s":0},
{"u":"","x":"ROLLBACK","s":0},
{"u":"","x":"ROW","s":0},
{"u":"","x":"SAVEPOINT","s":0},
{"u":"","x":"SELECT","s":0},
{"u":"","x":"SET","s":0},
{"u":"","x":"TABLE","s":0},
{"u":"","x":"TEMP","s":0},
{"u":"","x":"TEMPORARY","s":0},
{"u":"","x":"THEN","s":0},
{"u":"","x":"TO","s":0},
{"u":"","x":"TRANSACTION","s":0},
{"u":"","x":"TRIGGER","s":0},
{"u":"","x":"UNION","s":0},
{"u":"","x":"UNIQUE","s":0},
{"u":"","x":"UPDATE","s":0},
{"u":"","x":"USING","s":0},
{"u":"","x":"VACUUM","s":0},
{"u":"","x":"VALUES","s":0},
{"u":"","x":"VIEW","s":0},
{"u":"","x":"VIRTUAL","s":0},
{"u":"","x":"WHEN","s":0},
{"u":"","x":"WHERE","s":0},
{"u":"","x":"WITH","s":0},
{"u":"","x":"WITHOUT","s":0}];
var j = 0;
var w = Math.max(document.documentElement.clientWidth,  window.innerWidth || 0);
var nCol = Math.floor(w/200);
if(nCol<=0) nCol=1;
var nRow = Math.ceil((listitems29.length+1)/nCol);
var h="<tr><td><ul class='multicol_list'>"
var ea
for(var i=0; i<listitems29.length; i++){
  if( (++j)>nRow ){
    h += "</ul></td>\n<td><ul class='multicol_list'>\n";
    j = 1;
  }
  if(listitems29[i].u=="" || listitems29[i].s==2){
    h += "<li>"
    ea = ""
  }else{
    h += "<li><a href='";
    h += listitems29[i].u;
    h += "'>";
    ea = "</a>"
  }
  if(listitems29[i].s==2 || listitems29[i].s==3) h += "<s>"
  h += listitems29[i].x;
  if(listitems29[i].s==2 || listitems29[i].s==3) h += "</s>"
  h += ea
  if(listitems29[i].s==1) h += "<small><i>(exp)</i></small>\n";
  if(listitems29[i].s==3) h += "&sup1\n";
  if(listitems29[i].s==4) h += "&sup2\n";
  if(listitems29[i].s==5) h += "&sup3\n";
}
document.getElementById("listtab29").innerHTML = h;
</script>

<blockquote>
<table width="100%"><tr>
<td align="left" valign="top" width="20%">

