Debian Codegraph @

www/syntax/factored-select-stmt.html

raw
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: factored-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.svg" 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'>factored-select-stmt</h1>
119 <div class='imgcontainer'>
120 <div style="max-width:629px"><svg xmlns='http://www.w3.org/2000/svg' style='font-size:initial;' class="pikchr" viewBox="0 0 629.266 500.04" data-pikchr-date="20250319161943">
121 <circle cx="5.76" cy="17.28" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
122 <polygon points="45.36,17.28 33.84,21.6 33.84,12.96" style="fill:rgb(0,0,0)"/>
123 <path d="M9.36,17.28L39.6,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
124 <path d="M60.48,32.4L91.296,32.4A15.12 15.12 0 0 0 106.416 17.28A15.12 15.12 0 0 0 91.296 2.16L60.48,2.16A15.12 15.12 0 0 0 45.36 17.28A15.12 15.12 0 0 0 60.48 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
125 <text x="75.888" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
126 <path d="M166.536,62.64L252.302,62.64A15.12 15.12 0 0 0 267.422 47.52A15.12 15.12 0 0 0 252.302 32.4L166.536,32.4A15.12 15.12 0 0 0 151.416 47.52A15.12 15.12 0 0 0 166.536 62.64Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
127 <text x="209.419" y="47.52" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
128 <polygon points="209.419,17.28 197.899,21.6 197.899,12.96" style="fill:rgb(0,0,0)"/>
129 <path d="M106.416,17.28L203.659,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
130 <polygon points="357.422,17.28 345.902,21.6 345.902,12.96" style="fill:rgb(0,0,0)"/>
131 <path d="M209.419,17.28L351.662,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
132 <path d="M357.422,32.4L583.906,32.4L583.906,2.16L357.422,2.16Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
133 <text x="470.664" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
134 <polygon points="151.416,47.52 139.896,51.84 139.896,43.2" style="fill:rgb(0,0,0)"/>
135 <path d="M106.416,17.28 L 113.916,17.28 Q 121.416,17.28 121.416,32.28 L 121.416,32.52 Q 121.416,47.52 133.536,47.52 L 145.656,47.52" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
136 <polygon points="290.462,47.52 278.942,51.84 278.942,43.2" style="fill:rgb(0,0,0)"/>
137 <path d="M267.422,47.52L284.702,47.52" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
138 <path d="M290.462,47.52 L 297.962,47.52 Q 305.462,47.52 305.462,32.52 L 305.462,32.28 Q 305.462,17.28 320.462,17.28 L 330.902,17.28 L 345.902,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
139 <path d="M470.664,70.2A15.12 15.12 0 0 0 485.784 55.08L485.784,55.08A15.12 15.12 0 0 0 470.664 39.96A15.12 15.12 0 0 0 455.544 55.08L455.544,55.08A15.12 15.12 0 0 0 470.664 70.2Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
140 <text x="470.664" y="55.08" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
141 <polygon points="485.784,55.08 497.304,50.76 497.304,59.4" style="fill:rgb(0,0,0)"/>
142 <path d="M583.906,17.28 L 591.406,17.28 Q 598.906,17.28 598.906,32.28 L 598.906,40.08 Q 598.906,55.08 583.906,55.08 L 506.544,55.08 L 491.544,55.08" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
143 <path d="M455.544,55.08 L 349.382,55.08 Q 334.382,55.08 334.382,40.08 L 334.382,32.28 Q 334.382,17.28 340.142,17.28 L 345.902,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
144 <path d="M117.36,153.36L220.925,153.36L220.925,123.12L117.36,123.12Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
145 <text x="169.142" y="138.24" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
146 <path d="M60.48,304.56L105.005,304.56A15.12 15.12 0 0 0 120.125 289.44A15.12 15.12 0 0 0 105.005 274.32L60.48,274.32A15.12 15.12 0 0 0 45.36 289.44A15.12 15.12 0 0 0 60.48 304.56Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
147 <text x="82.7424" y="289.44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
148 <polygon points="143.165,289.44 131.645,293.76 131.645,285.12" style="fill:rgb(0,0,0)"/>
149 <path d="M120.125,289.44L137.405,289.44" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
150 <path d="M158.285,304.56L162.374,304.56A15.12 15.12 0 0 0 177.494 289.44A15.12 15.12 0 0 0 162.374 274.32L158.285,274.32A15.12 15.12 0 0 0 143.165 289.44A15.12 15.12 0 0 0 158.285 304.56Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
151 <text x="160.33" y="289.44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
152 <path d="M60.48,410.4L93.9456,410.4A15.12 15.12 0 0 0 109.066 395.28A15.12 15.12 0 0 0 93.9456 380.16L60.48,380.16A15.12 15.12 0 0 0 45.36 395.28A15.12 15.12 0 0 0 60.48 410.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
153 <text x="77.2128" y="395.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
154 <polygon points="132.106,395.28 120.586,399.6 120.586,390.96" style="fill:rgb(0,0,0)"/>
155 <path d="M109.066,395.28L126.346,395.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
156 <path d="M132.106,410.4L181.296,410.4L181.296,380.16L132.106,380.16Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
157 <text x="156.701" y="395.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
158 <polygon points="117.36,138.24 105.84,142.56 105.84,133.92" style="fill:rgb(0,0,0)"/>
159 <path d="M9.36,17.28 L 16.86,17.28 Q 24.36,17.28 24.36,32.28 L 24.36,123.24 Q 24.36,138.24 39.36,138.24 L 96.6,138.24 L 111.6,138.24" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
160 <polygon points="312.422,92.88 323.942,88.56 323.942,97.2" style="fill:rgb(0,0,0)"/>
161 <path d="M583.906,17.28 L 604.906,17.28 Q 619.906,17.28 619.906,32.28 L 619.906,77.88 Q 619.906,92.88 604.906,92.88 L 333.182,92.88 L 318.182,92.88" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
162 <path d="M312.422,92.88 L 39.36,92.88 Q 24.36,92.88 24.36,100.38 L 24.36,107.88" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
163 <path d="M80.784,198.72L257.501,198.72L257.501,168.48L80.784,168.48Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
164 <text x="169.142" y="183.6" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
165 <polygon points="257.501,183.6 269.021,179.28 269.021,187.92" style="fill:rgb(0,0,0)"/>
166 <path d="M272.501,138.24 L 280.001,138.24 Q 287.501,138.24 287.501,153.24 L 287.501,168.6 Q 287.501,183.6 275.381,183.6 L 263.261,183.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
167 <path d="M80.784,183.6 L 65.784,183.6 Q 50.784,183.6 50.784,168.6 L 50.784,153.24 Q 50.784,138.24 58.284,138.24 L 65.784,138.24" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
168 <polygon points="296.633,236.52 308.153,232.2 308.153,240.84" style="fill:rgb(0,0,0)"/>
169 <path d="M220.925,138.24 L 342.422,138.24 Q 357.422,138.24 357.422,153.24 L 357.422,221.52 Q 357.422,236.52 342.422,236.52 L 317.393,236.52 L 302.393,236.52" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
170 <polygon points="45.36,289.44 33.84,293.76 33.84,285.12" style="fill:rgb(0,0,0)"/>
171 <path d="M296.633,236.52 L 39.36,236.52 Q 24.36,236.52 24.36,251.52 L 24.36,274.44 Q 24.36,289.44 31.98,289.44 L 39.6,289.44" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
172 <polygon points="222.494,289.44 210.974,293.76 210.974,285.12" style="fill:rgb(0,0,0)"/>
173 <path d="M177.494,289.44L216.734,289.44" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
174 <path d="M222.494,304.56L352.325,304.56L352.325,274.32L222.494,274.32Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
175 <text x="287.41" y="289.44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
176 <path d="M287.41,342.36A15.12 15.12 0 0 0 302.53 327.24A15.12 15.12 0 0 0 287.41 312.12A15.12 15.12 0 0 0 272.29 327.24A15.12 15.12 0 0 0 287.41 342.36Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
177 <text x="287.41" y="327.24" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
178 <polygon points="302.53,327.24 314.05,322.92 314.05,331.56" style="fill:rgb(0,0,0)"/>
179 <path d="M352.325,289.44 L 359.825,289.44 Q 367.325,289.44 367.325,304.44 L 367.325,312.24 Q 367.325,327.24 352.325,327.24 L 323.29,327.24 L 308.29,327.24" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
180 <path d="M272.29,327.24 L 214.454,327.24 Q 199.454,327.24 199.454,312.24 L 199.454,304.44 Q 199.454,289.44 205.214,289.44 L 210.974,289.44" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
181 <polygon points="388.325,319.68 384.005,308.16 392.645,308.16" style="fill:rgb(0,0,0)"/>
182 <path d="M352.325,289.44 L 373.325,289.44 Q 388.325,289.44 388.325,301.68 L 388.325,313.92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
183 <polygon points="198.842,361.26 210.362,356.94 210.362,365.58" style="fill:rgb(0,0,0)"/>
184 <path d="M388.325,319.68 L 388.325,346.26 Q 388.325,361.26 373.325,361.26 L 219.602,361.26 L 204.602,361.26" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
185 <polygon points="45.36,395.28 33.84,399.6 33.84,390.96" style="fill:rgb(0,0,0)"/>
186 <path d="M198.842,361.26 L 39.36,361.26 Q 24.36,361.26 24.36,376.26 L 24.36,380.28 Q 24.36,395.28 31.98,395.28 L 39.6,395.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
187 <polygon points="24.36,327.312 20.04,315.792 28.68,315.792" style="fill:rgb(0,0,0)"/>
188 <path d="M24.36,274.32L24.36,321.552" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
189 <path d="M24.36,327.312L24.36,380.304" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
190 <path d="M255.456,440.64L306.778,440.64A15.12 15.12 0 0 0 321.898 425.52A15.12 15.12 0 0 0 306.778 410.4L255.456,410.4A15.12 15.12 0 0 0 240.336 425.52A15.12 15.12 0 0 0 255.456 440.64Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
191 <text x="281.117" y="425.52" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
192 <polygon points="344.938,425.52 333.418,429.84 333.418,421.2" style="fill:rgb(0,0,0)"/>
193 <path d="M321.898,425.52L339.178,425.52" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
194 <path d="M344.938,440.64L394.128,440.64L394.128,410.4L344.938,410.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
195 <text x="369.533" y="425.52" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
196 <polygon points="417.168,425.52 405.648,429.84 405.648,421.2" style="fill:rgb(0,0,0)"/>
197 <path d="M394.128,425.52L411.408,425.52" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
198 <path d="M255.456,478.44A15.12 15.12 0 0 0 270.576 463.32A15.12 15.12 0 0 0 255.456 448.2A15.12 15.12 0 0 0 240.336 463.32A15.12 15.12 0 0 0 255.456 478.44Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
199 <text x="255.456" y="463.32" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
200 <polygon points="293.616,463.32 282.096,467.64 282.096,459" style="fill:rgb(0,0,0)"/>
201 <path d="M270.576,463.32L287.856,463.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
202 <path d="M293.616,478.44L342.806,478.44L342.806,448.2L293.616,448.2Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
203 <text x="318.211" y="463.32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
204 <polygon points="204.336,395.28 192.816,399.6 192.816,390.96" style="fill:rgb(0,0,0)"/>
205 <path d="M181.296,395.28L198.576,395.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
206 <polygon points="240.336,463.32 228.816,467.64 228.816,459" style="fill:rgb(0,0,0)"/>
207 <path d="M204.336,395.28 L 211.836,395.28 Q 219.336,395.28 219.336,410.28 L 219.336,448.32 Q 219.336,463.32 226.956,463.32 L 234.576,463.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
208 <polygon points="240.336,425.52 228.816,429.84 228.816,421.2" style="fill:rgb(0,0,0)"/>
209 <path d="M204.336,395.28 L 211.836,395.28 Q 219.336,395.28 219.336,410.28 L 219.336,410.52 Q 219.336,425.52 226.956,425.52 L 234.576,425.52" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
210 <polygon points="417.168,395.28 405.648,399.6 405.648,390.96" style="fill:rgb(0,0,0)"/>
211 <path d="M204.336,395.28L411.408,395.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
212 <polygon points="619.906,493.56 608.386,497.88 608.386,489.24" style="fill:rgb(0,0,0)"/>
213 <path d="M417.168,395.28 L 438.168,395.28 Q 453.168,395.28 453.168,410.28 L 453.168,478.56 Q 453.168,493.56 468.168,493.56 L 599.146,493.56 L 614.146,493.56" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
214 <circle cx="623.506" cy="493.56" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
215 <path d="M417.168,425.52 L 438.168,425.52 Q 453.168,425.52 453.168,433.02 L 453.168,440.52" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
216 <polygon points="417.168,463.32 405.648,467.64 405.648,459" style="fill:rgb(0,0,0)"/>
217 <path d="M342.806,463.32L411.408,463.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
218 <path d="M417.168,463.32 L 438.168,463.32 Q 453.168,463.32 453.168,470.82 L 453.168,478.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
219 <polygon points="417.168,493.56 405.648,497.88 405.648,489.24" style="fill:rgb(0,0,0)"/>
220 <path d="M24.36,380.16 L 24.36,478.56 Q 24.36,493.56 39.36,493.56 L 396.408,493.56 L 411.408,493.56" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
221 <path d="M417.168,493.56L489.168,493.56" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
222 </svg>
223 </div><br>
224 <br></br>
225 References:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./compound-operator.html'>compound-operator</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a>&nbsp;&nbsp; <a href='./select-core.html'>select-core</a><br></br>
226 See also:&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>
227 </div>
228
229
230