| 1 |
<!DOCTYPE html> |
| 2 |
<html><head> |
| 3 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 4 |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| 5 |
<link href="../sqlite.css" rel="stylesheet"> |
| 6 |
<title>SQLite Syntax: simple-select-stmt</title> |
| 7 |
<!-- path=../ --> |
| 8 |
</head> |
| 9 |
<body> |
| 10 |
<div class=nosearch> |
| 11 |
<a href="../index.html"> |
| 12 |
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> |
| 13 |
</a> |
| 14 |
<div><!-- IE hack to prevent disappearing logo --></div> |
| 15 |
<div class="tagline desktoponly"> |
| 16 |
Small. Fast. Reliable.<br>Choose any three. |
| 17 |
</div> |
| 18 |
<div class="menu mainmenu"> |
| 19 |
<ul> |
| 20 |
<li><a href="../index.html">Home</a> |
| 21 |
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> |
| 22 |
<li class='wideonly'><a href='../about.html'>About</a> |
| 23 |
<li class='desktoponly'><a href="../docs.html">Documentation</a> |
| 24 |
<li class='desktoponly'><a href="../download.html">Download</a> |
| 25 |
<li class='wideonly'><a href='../copyright.html'>License</a> |
| 26 |
<li class='desktoponly'><a href="../support.html">Support</a> |
| 27 |
<li class='desktoponly'><a href="../prosupport.html">Purchase</a> |
| 28 |
<li class='search' id='search_menubutton'> |
| 29 |
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a> |
| 30 |
</ul> |
| 31 |
</div> |
| 32 |
<div class="menu submenu" id="submenu"> |
| 33 |
<ul> |
| 34 |
<li><a href='../about.html'>About</a> |
| 35 |
<li><a href='../docs.html'>Documentation</a> |
| 36 |
<li><a href='../download.html'>Download</a> |
| 37 |
<li><a href='../support.html'>Support</a> |
| 38 |
<li><a href='../prosupport.html'>Purchase</a> |
| 39 |
</ul> |
| 40 |
</div> |
| 41 |
<div class="searchmenu" id="searchmenu"> |
| 42 |
<form method="GET" action="../search"> |
| 43 |
<select name="s" id="searchtype"> |
| 44 |
<option value="d">Search Documentation</option> |
| 45 |
<option value="c">Search Changelog</option> |
| 46 |
</select> |
| 47 |
<input type="text" name="q" id="searchbox" value=""> |
| 48 |
<input type="submit" value="Go"> |
| 49 |
</form> |
| 50 |
</div> |
| 51 |
</div> |
| 52 |
<script> |
| 53 |
function toggle_div(nm) { |
| 54 |
var w = document.getElementById(nm); |
| 55 |
if( w.style.display=="block" ){ |
| 56 |
w.style.display = "none"; |
| 57 |
}else{ |
| 58 |
w.style.display = "block"; |
| 59 |
} |
| 60 |
} |
| 61 |
function toggle_search() { |
| 62 |
var w = document.getElementById("searchmenu"); |
| 63 |
if( w.style.display=="block" ){ |
| 64 |
w.style.display = "none"; |
| 65 |
} else { |
| 66 |
w.style.display = "block"; |
| 67 |
setTimeout(function(){ |
| 68 |
document.getElementById("searchbox").focus() |
| 69 |
}, 30); |
| 70 |
} |
| 71 |
} |
| 72 |
function div_off(nm){document.getElementById(nm).style.display="none";} |
| 73 |
window.onbeforeunload = function(e){div_off("submenu");} |
| 74 |
/* Disable the Search feature if we are not operating from CGI, since */ |
| 75 |
/* Search is accomplished using CGI and will not work without it. */ |
| 76 |
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ |
| 77 |
document.getElementById("search_menubutton").style.display = "none"; |
| 78 |
} |
| 79 |
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */ |
| 80 |
function hideorshow(btn,obj){ |
| 81 |
var x = document.getElementById(obj); |
| 82 |
var b = document.getElementById(btn); |
| 83 |
if( x.style.display!='none' ){ |
| 84 |
x.style.display = 'none'; |
| 85 |
b.innerHTML='show'; |
| 86 |
}else{ |
| 87 |
x.style.display = ''; |
| 88 |
b.innerHTML='hide'; |
| 89 |
} |
| 90 |
return false; |
| 91 |
} |
| 92 |
var antiRobot = 0; |
| 93 |
function antiRobotGo(){ |
| 94 |
if( antiRobot!=3 ) return; |
| 95 |
antiRobot = 7; |
| 96 |
var j = document.getElementById("mtimelink"); |
| 97 |
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); |
| 98 |
} |
| 99 |
function antiRobotDefense(){ |
| 100 |
document.body.onmousedown=function(){ |
| 101 |
antiRobot |= 2; |
| 102 |
antiRobotGo(); |
| 103 |
document.body.onmousedown=null; |
| 104 |
} |
| 105 |
document.body.onmousemove=function(){ |
| 106 |
antiRobot |= 2; |
| 107 |
antiRobotGo(); |
| 108 |
document.body.onmousemove=null; |
| 109 |
} |
| 110 |
setTimeout(function(){ |
| 111 |
antiRobot |= 1; |
| 112 |
antiRobotGo(); |
| 113 |
}, 100) |
| 114 |
antiRobotGo(); |
| 115 |
} |
| 116 |
antiRobotDefense(); |
| 117 |
</script> |
| 118 |
<h1 align='center'>simple-select-stmt</h1> |
| 119 |
<div class='imgcontainer'> |
| 120 |
<div style="max-width:629px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 629.266 348.84"> |
| 121 |
<circle cx="5" cy="17" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 122 |
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/> |
| 123 |
<path d="M9,17L39,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 124 |
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 125 |
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text> |
| 126 |
<path d="M166,62L252,62A15 15 0 0 0 267 47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47A15 15 0 0 0 166 62Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 127 |
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text> |
| 128 |
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/> |
| 129 |
<path d="M106,17L203,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 130 |
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/> |
| 131 |
<path d="M209,17L351,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 132 |
<path d="M357,32L583,32L583,2L357,2Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 133 |
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text> |
| 134 |
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/> |
| 135 |
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 136 |
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/> |
| 137 |
<path d="M267,47L284,47" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 138 |
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 139 |
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 140 |
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text> |
| 141 |
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/> |
| 142 |
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 143 |
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 144 |
<path d="M45,153L148,153L148,123L45,123Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 145 |
<text x="97" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text> |
| 146 |
<path d="M205,153L250,153A15 15 0 0 0 265 138A15 15 0 0 0 250 123L205,123A15 15 0 0 0 190 138A15 15 0 0 0 205 153Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 147 |
<text x="227" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text> |
| 148 |
<polygon points="288,138 276,142 276,133" style="fill:rgb(0,0,0)"/> |
| 149 |
<path d="M265,138L282,138" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 150 |
<path d="M303,153L307,153A15 15 0 0 0 322 138A15 15 0 0 0 307 123L303,123A15 15 0 0 0 288 138A15 15 0 0 0 303 153Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 151 |
<text x="305" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text> |
| 152 |
<path d="M205,259L239,259A15 15 0 0 0 254 244A15 15 0 0 0 239 228L205,228A15 15 0 0 0 190 244A15 15 0 0 0 205 259Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 153 |
<text x="222" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text> |
| 154 |
<polygon points="277,244 265,248 265,239" style="fill:rgb(0,0,0)"/> |
| 155 |
<path d="M254,244L271,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 156 |
<path d="M277,259L326,259L326,228L277,228Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 157 |
<text x="301" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text> |
| 158 |
<polygon points="45,138 33,142 33,133" style="fill:rgb(0,0,0)"/> |
| 159 |
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,123 Q 24,138 31,138 L 39,138" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 160 |
<polygon points="312,92 323,88 323,97" style="fill:rgb(0,0,0)"/> |
| 161 |
<path d="M583,17 L 604,17 Q 619,17 619,32 L 619,77 Q 619,92 604,92 L 333,92 L 318,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 162 |
<path d="M312,92 L 39,92 Q 24,92 24,100 L 24,107" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 163 |
<polygon points="367,138 356,142 356,133" style="fill:rgb(0,0,0)"/> |
| 164 |
<path d="M322,138L361,138" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 165 |
<path d="M367,153L497,153L497,123L367,123Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 166 |
<text x="432" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text> |
| 167 |
<path d="M432,191A15 15 0 0 0 447 176A15 15 0 0 0 432 160A15 15 0 0 0 417 176A15 15 0 0 0 432 191Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 168 |
<text x="432" y="176" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text> |
| 169 |
<polygon points="447,176 459,171 459,180" style="fill:rgb(0,0,0)"/> |
| 170 |
<path d="M497,138 L 504,138 Q 512,138 512,153 L 512,161 Q 512,176 497,176 L 468,176 L 453,176" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 171 |
<path d="M417,176 L 359,176 Q 344,176 344,161 L 344,153 Q 344,138 350,138 L 356,138" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 172 |
<polygon points="533,168 529,156 537,156" style="fill:rgb(0,0,0)"/> |
| 173 |
<path d="M497,138 L 518,138 Q 533,138 533,150 L 533,162" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 174 |
<polygon points="343,210 355,205 355,214" style="fill:rgb(0,0,0)"/> |
| 175 |
<path d="M533,168 L 533,195 Q 533,210 518,210 L 364,210 L 349,210" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 176 |
<polygon points="190,244 178,248 178,239" style="fill:rgb(0,0,0)"/> |
| 177 |
<path d="M343,210 L 178,210 Q 163,210 163,225 L 163,229 Q 163,244 174,244 L 184,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 178 |
<polygon points="190,138 178,142 178,133" style="fill:rgb(0,0,0)"/> |
| 179 |
<path d="M148,138L184,138" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 180 |
<polygon points="163,191 159,179 168,179" style="fill:rgb(0,0,0)"/> |
| 181 |
<path d="M148,138 L 156,138 Q 163,138 163,153 L 163,170 L 163,185" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 182 |
<path d="M163,191L163,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 183 |
<path d="M400,289L451,289A15 15 0 0 0 466 274A15 15 0 0 0 451 259L400,259A15 15 0 0 0 385 274A15 15 0 0 0 400 289Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 184 |
<text x="426" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text> |
| 185 |
<polygon points="490,274 478,278 478,270" style="fill:rgb(0,0,0)"/> |
| 186 |
<path d="M466,274L484,274" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 187 |
<path d="M490,289L539,289L539,259L490,259Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 188 |
<text x="514" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text> |
| 189 |
<polygon points="562,274 550,278 550,270" style="fill:rgb(0,0,0)"/> |
| 190 |
<path d="M539,274L556,274" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 191 |
<path d="M400,327A15 15 0 0 0 415 312A15 15 0 0 0 400 297A15 15 0 0 0 385 312A15 15 0 0 0 400 327Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 192 |
<text x="400" y="312" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text> |
| 193 |
<polygon points="438,312 427,316 427,307" style="fill:rgb(0,0,0)"/> |
| 194 |
<path d="M415,312L432,312" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 195 |
<path d="M438,327L487,327L487,297L438,297Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 196 |
<text x="463" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text> |
| 197 |
<polygon points="349,244 337,248 337,239" style="fill:rgb(0,0,0)"/> |
| 198 |
<path d="M326,244L343,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 199 |
<polygon points="385,312 373,316 373,307" style="fill:rgb(0,0,0)"/> |
| 200 |
<path d="M349,244 L 356,244 Q 364,244 364,259 L 364,297 Q 364,312 372,312 L 379,312" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 201 |
<polygon points="385,274 373,278 373,270" style="fill:rgb(0,0,0)"/> |
| 202 |
<path d="M349,244 L 356,244 Q 364,244 364,259 L 364,259 Q 364,274 372,274 L 379,274" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 203 |
<polygon points="562,244 550,248 550,239" style="fill:rgb(0,0,0)"/> |
| 204 |
<path d="M349,244L556,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 205 |
<polygon points="619,342 608,346 608,338" style="fill:rgb(0,0,0)"/> |
| 206 |
<path d="M562,244 L 583,244 Q 598,244 598,259 L 598,327 Q 598,342 606,342 L 614,342" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 207 |
<circle cx="623" cy="342" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 208 |
<path d="M562,274 L 583,274 Q 598,274 598,281 L 598,289" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 209 |
<polygon points="562,312 550,316 550,307" style="fill:rgb(0,0,0)"/> |
| 210 |
<path d="M487,312L556,312" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 211 |
<path d="M562,312 L 583,312 Q 598,312 598,319 L 598,327" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 212 |
<polygon points="562,342 550,346 550,338" style="fill:rgb(0,0,0)"/> |
| 213 |
<path d="M163,228 L 163,327 Q 163,342 178,342 L 541,342 L 556,342" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 214 |
<path d="M562,342L608,342" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 215 |
</svg> |
| 216 |
</div><br> |
| 217 |
<br></br> |
| 218 |
References: <a href='./common-table-expression.html'>common-table-expression</a> <a href='./expr.html'>expr</a> <a href='./ordering-term.html'>ordering-term</a> <a href='./select-core.html'>select-core</a><br></br> |
| 219 |
See also: <a href='../lang_select.html'>lang_select.html</a> |
| 220 |
</div> |
| 221 |
|
| 222 |
|
| 223 |
|