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
|
<!DOCTYPE html>
<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 Syntax: compound-select-stmt</title>
<!-- path=../ -->
</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_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</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">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<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 toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
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 || !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);
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;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>compound-select-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:652px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 652.306 560.52">
<circle cx="5" cy="17" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L114,32A15 15 0 0 0 129 17A15 15 0 0 0 114 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="98" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M189,62L275,62A15 15 0 0 0 290 47L290,47A15 15 0 0 0 275 32L189,32A15 15 0 0 0 174 47L174,47A15 15 0 0 0 189 62Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="232,17 220,21 220,12" style="fill:rgb(0,0,0)"/>
<path d="M129,17L226,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,17 368,21 368,12" style="fill:rgb(0,0,0)"/>
<path d="M232,17L374,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,32L606,32L606,2L380,2Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="174,47 162,51 162,43" style="fill:rgb(0,0,0)"/>
<path d="M129,17 L 136,17 Q 144,17 144,32 L 144,32 Q 144,47 156,47 L 168,47" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,47 301,51 301,43" style="fill:rgb(0,0,0)"/>
<path d="M290,47L307,47" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,47 L 321,47 Q 328,47 328,32 L 328,32 Q 328,17 343,17 L 353,17 L 368,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,70A15 15 0 0 0 508 55L508,55A15 15 0 0 0 493 39A15 15 0 0 0 478 55L478,55A15 15 0 0 0 493 70Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="508,55 520,50 520,59" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,40 Q 621,55 606,55 L 529,55 L 514,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,55 L 372,55 Q 357,55 357,40 L 357,32 Q 357,17 363,17 L 368,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M68,183L171,183L171,153L68,153Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="120" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M83,365L128,365A15 15 0 0 0 143 349A15 15 0 0 0 128 334L83,334A15 15 0 0 0 68 349A15 15 0 0 0 83 365Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="166,349 154,354 154,345" style="fill:rgb(0,0,0)"/>
<path d="M143,349L160,349" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M181,365L185,365A15 15 0 0 0 200 349A15 15 0 0 0 185 334L181,334A15 15 0 0 0 166 349A15 15 0 0 0 181 365Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M83,470L116,470A15 15 0 0 0 132 455A15 15 0 0 0 116 440L83,440A15 15 0 0 0 68 455A15 15 0 0 0 83 470Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="100" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="155,455 143,460 143,451" style="fill:rgb(0,0,0)"/>
<path d="M132,455L149,455" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M155,470L204,470L204,440L155,440Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="68,168 56,172 56,164" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,153 Q 47,168 55,168 L 62,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="335,92 346,88 346,97" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 627,17 Q 642,17 642,32 L 642,77 Q 642,92 627,92 L 356,92 L 341,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M335,92 L 62,92 Q 47,92 47,100 L 47,107" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,168 232,172 232,164" style="fill:rgb(0,0,0)"/>
<path d="M171,168L238,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,183L302,183A15 15 0 0 0 317 168A15 15 0 0 0 302 153L259,153A15 15 0 0 0 243 168A15 15 0 0 0 259 183Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M259,221L302,221A15 15 0 0 0 317 206A15 15 0 0 0 302 191L259,191A15 15 0 0 0 243 206A15 15 0 0 0 259 221Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<polygon points="340,206 329,210 329,201" style="fill:rgb(0,0,0)"/>
<path d="M317,206L335,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M355,221L370,221A15 15 0 0 0 386 206A15 15 0 0 0 370 191L355,191A15 15 0 0 0 340 206A15 15 0 0 0 355 221Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="409,206 397,210 397,201" style="fill:rgb(0,0,0)"/>
<path d="M386,206L403,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,168 435,172 435,164" style="fill:rgb(0,0,0)"/>
<path d="M409,206 L 416,206 Q 424,206 424,191 L 424,183 Q 424,168 432,168 L 441,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,183L550,183L550,153L447,153Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="498" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M259,259L343,259A15 15 0 0 0 359 244A15 15 0 0 0 343 228L259,228A15 15 0 0 0 243 244A15 15 0 0 0 259 259Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M259,297L310,297A15 15 0 0 0 325 281A15 15 0 0 0 310 266L259,266A15 15 0 0 0 243 281A15 15 0 0 0 259 297Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="284" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="243,281 232,286 232,277" style="fill:rgb(0,0,0)"/>
<path d="M205,168 L 213,168 Q 220,168 220,183 L 220,266 Q 220,281 229,281 L 238,281" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,244 232,248 232,239" style="fill:rgb(0,0,0)"/>
<path d="M220,228 L 220,236 Q 220,244 229,244 L 238,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,206 232,210 232,201" style="fill:rgb(0,0,0)"/>
<path d="M220,191 L 220,198 Q 220,206 229,206 L 238,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="409,244 397,248 397,239" style="fill:rgb(0,0,0)"/>
<path d="M359,244L403,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,244 L 416,244 Q 424,244 424,229 L 424,206 L 424,191" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="409,281 397,286 397,277" style="fill:rgb(0,0,0)"/>
<path d="M325,281L403,281" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,281 L 416,281 Q 424,281 424,266 L 424,243 L 424,228" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,168L435,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,138 389,133 389,142" style="fill:rgb(0,0,0)"/>
<path d="M550,168 L 558,168 Q 565,168 565,153 L 565,153 Q 565,138 550,138 L 399,138 L 384,138" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M378,138 L 205,138 Q 190,138 190,153 L 190,153 Q 190,168 198,168 L 205,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="319,315 331,311 331,320" style="fill:rgb(0,0,0)"/>
<path d="M550,168 L 571,168 Q 586,168 586,183 L 586,300 Q 586,315 571,315 L 340,315 L 325,315" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,349 56,354 56,345" style="fill:rgb(0,0,0)"/>
<path d="M319,315 L 62,315 Q 47,315 47,330 L 47,334 Q 47,349 55,349 L 62,349" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,349 234,354 234,345" style="fill:rgb(0,0,0)"/>
<path d="M200,349L239,349" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,365L375,365L375,334L245,334Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,402A15 15 0 0 0 325 387A15 15 0 0 0 310 372A15 15 0 0 0 295 387A15 15 0 0 0 310 402Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="387" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,387 337,383 337,392" style="fill:rgb(0,0,0)"/>
<path d="M375,349 L 382,349 Q 390,349 390,364 L 390,372 Q 390,387 375,387 L 346,387 L 331,387" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,387 L 237,387 Q 222,387 222,372 L 222,364 Q 222,349 228,349 L 234,349" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,380 407,368 415,368" style="fill:rgb(0,0,0)"/>
<path d="M375,349 L 396,349 Q 411,349 411,362 L 411,374" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,421 233,417 233,426" style="fill:rgb(0,0,0)"/>
<path d="M411,380 L 411,406 Q 411,421 396,421 L 242,421 L 227,421" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,455 56,460 56,451" style="fill:rgb(0,0,0)"/>
<path d="M221,421 L 62,421 Q 47,421 47,436 L 47,440 Q 47,455 55,455 L 62,455" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,387 43,376 51,376" style="fill:rgb(0,0,0)"/>
<path d="M47,334L47,382" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,387L47,440" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,501L329,501A15 15 0 0 0 344 486A15 15 0 0 0 329 470L278,470A15 15 0 0 0 263 486A15 15 0 0 0 278 501Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="304" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="367,486 356,490 356,481" style="fill:rgb(0,0,0)"/>
<path d="M344,486L362,486" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,501L417,501L417,470L367,470Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="392" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="440,486 428,490 428,481" style="fill:rgb(0,0,0)"/>
<path d="M417,486L434,486" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,538A15 15 0 0 0 293 523A15 15 0 0 0 278 508A15 15 0 0 0 263 523A15 15 0 0 0 278 538Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="523" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="316,523 305,528 305,519" style="fill:rgb(0,0,0)"/>
<path d="M293,523L310,523" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,538L365,538L365,508L316,508Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="341" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="227,455 215,460 215,451" style="fill:rgb(0,0,0)"/>
<path d="M204,455L221,455" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="263,523 251,528 251,519" style="fill:rgb(0,0,0)"/>
<path d="M227,455 L 234,455 Q 242,455 242,470 L 242,508 Q 242,523 249,523 L 257,523" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="263,486 251,490 251,481" style="fill:rgb(0,0,0)"/>
<path d="M227,455 L 234,455 Q 242,455 242,470 L 242,471 Q 242,486 249,486 L 257,486" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,455 428,460 428,451" style="fill:rgb(0,0,0)"/>
<path d="M227,455L434,455" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="642,554 631,558 631,549" style="fill:rgb(0,0,0)"/>
<path d="M440,455 L 461,455 Q 476,455 476,470 L 476,539 Q 476,554 491,554 L 622,554 L 637,554" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="646" cy="554" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,486 L 461,486 Q 476,486 476,493 L 476,501" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,523 428,528 428,519" style="fill:rgb(0,0,0)"/>
<path d="M365,523L434,523" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,523 L 461,523 Q 476,523 476,531 L 476,538" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,554 428,558 428,549" style="fill:rgb(0,0,0)"/>
<path d="M47,440 L 47,539 Q 47,554 62,554 L 419,554 L 434,554" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,554L512,554" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
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>
See also: <a href='../lang_select.html'>lang_select.html</a>
</div>
|