| 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: with-clause</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'>with-clause</h1> |
| 119 |
<div class='imgcontainer'> |
| 120 |
<div style="max-width:1056px"><svg xmlns='http://www.w3.org/2000/svg' style='font-size:initial;' class="pikchr" viewBox="0 0 1056.72 140.4" data-pikchr-date="20250319161943"> |
| 121 |
<circle cx="5.76" cy="85.32" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 122 |
<polygon points="32.4,85.32 20.88,89.64 20.88,81" style="fill:rgb(0,0,0)"/> |
| 123 |
<path d="M9.36,85.32L26.64,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 124 |
<path d="M47.52,100.44L78.336,100.44A15.12 15.12 0 0 0 93.456 85.32A15.12 15.12 0 0 0 78.336 70.2L47.52,70.2A15.12 15.12 0 0 0 32.4 85.32A15.12 15.12 0 0 0 47.52 100.44Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 125 |
<text x="62.928" y="85.32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text> |
| 126 |
<polygon points="134.976,55.08 123.456,59.4 123.456,50.76" style="fill:rgb(0,0,0)"/> |
| 127 |
<path d="M93.456,85.32 L 100.956,85.32 Q 108.456,85.32 108.456,70.32 L 108.456,70.08 Q 108.456,55.08 118.836,55.08 L 129.216,55.08" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 128 |
<path d="M150.096,70.2L235.862,70.2A15.12 15.12 0 0 0 250.982 55.08L250.982,55.08A15.12 15.12 0 0 0 235.862 39.96L150.096,39.96A15.12 15.12 0 0 0 134.976 55.08L134.976,55.08A15.12 15.12 0 0 0 150.096 70.2Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 129 |
<text x="192.979" y="55.08" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text> |
| 130 |
<path d="M250.982,55.08 L 258.482,55.08 Q 265.982,55.08 265.982,70.08 L 265.982,70.32 Q 265.982,85.32 273.482,85.32 L 280.982,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 131 |
<polygon points="307.502,85.32 295.982,89.64 295.982,81" style="fill:rgb(0,0,0)"/> |
| 132 |
<path d="M280.982,85.32L301.742,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 133 |
<path d="M307.502,100.44L444.13,100.44L444.13,70.2L307.502,70.2Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 134 |
<text x="375.816" y="85.32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">cte-table-name</text> |
| 135 |
<polygon points="467.17,85.32 455.65,89.64 455.65,81" style="fill:rgb(0,0,0)"/> |
| 136 |
<path d="M444.13,85.32L461.41,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 137 |
<path d="M482.29,100.44L486.264,100.44A15.12 15.12 0 0 0 501.384 85.32A15.12 15.12 0 0 0 486.264 70.2L482.29,70.2A15.12 15.12 0 0 0 467.17 85.32A15.12 15.12 0 0 0 482.29 100.44Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 138 |
<text x="484.277" y="85.32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text> |
| 139 |
<polygon points="542.904,17.28 531.384,21.6 531.384,12.96" style="fill:rgb(0,0,0)"/> |
| 140 |
<path d="M501.384,85.32 L 508.884,85.32 Q 516.384,85.32 516.384,70.32 L 516.384,32.28 Q 516.384,17.28 526.764,17.28 L 537.144,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 141 |
<path d="M558.024,32.4L578.126,32.4A15.12 15.12 0 0 0 593.246 17.28L593.246,17.28A15.12 15.12 0 0 0 578.126 2.16L558.024,2.16A15.12 15.12 0 0 0 542.904 17.28L542.904,17.28A15.12 15.12 0 0 0 558.024 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 142 |
<text x="568.075" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text> |
| 143 |
<polygon points="610.526,17.28 599.006,21.6 599.006,12.96" style="fill:rgb(0,0,0)"/> |
| 144 |
<path d="M593.246,17.28L604.766,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 145 |
<path d="M625.646,32.4L743.899,32.4A15.12 15.12 0 0 0 759.019 17.28L759.019,17.28A15.12 15.12 0 0 0 743.899 2.16L625.646,2.16A15.12 15.12 0 0 0 610.526 17.28L610.526,17.28A15.12 15.12 0 0 0 625.646 32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 146 |
<text x="684.773" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text> |
| 147 |
<polygon points="800.539,85.32 789.019,89.64 789.019,81" style="fill:rgb(0,0,0)"/> |
| 148 |
<path d="M759.019,17.28 L 766.519,17.28 Q 774.019,17.28 774.019,32.28 L 774.019,70.32 Q 774.019,85.32 784.399,85.32 L 794.779,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 149 |
<path d="M815.659,100.44A15.12 15.12 0 0 0 830.779 85.32A15.12 15.12 0 0 0 815.659 70.2A15.12 15.12 0 0 0 800.539 85.32A15.12 15.12 0 0 0 815.659 100.44Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 150 |
<text x="815.659" y="85.32" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text> |
| 151 |
<polygon points="853.819,85.32 842.299,89.64 842.299,81" style="fill:rgb(0,0,0)"/> |
| 152 |
<path d="M830.779,85.32L848.059,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 153 |
<path d="M853.819,100.44L958.075,100.44L958.075,70.2L853.819,70.2Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 154 |
<text x="905.947" y="85.32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text> |
| 155 |
<polygon points="981.115,85.32 969.595,89.64 969.595,81" style="fill:rgb(0,0,0)"/> |
| 156 |
<path d="M958.075,85.32L975.355,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 157 |
<path d="M996.235,100.44A15.12 15.12 0 0 0 1011.36 85.32A15.12 15.12 0 0 0 996.235 70.2A15.12 15.12 0 0 0 981.115 85.32A15.12 15.12 0 0 0 996.235 100.44Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 158 |
<text x="996.235" y="85.32" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text> |
| 159 |
<polygon points="1047.36,85.32 1035.84,89.64 1035.84,81" style="fill:rgb(0,0,0)"/> |
| 160 |
<path d="M1011.36,85.32L1041.6,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 161 |
<circle cx="1050.96" cy="85.32" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 162 |
<polygon points="542.904,56.592 531.384,60.912 531.384,52.272" style="fill:rgb(0,0,0)"/> |
| 163 |
<path d="M501.384,85.32 L 508.884,85.32 Q 516.384,85.32 516.384,70.956 Q 516.384,56.592 526.764,56.592 L 537.144,56.592" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 164 |
<path d="M558.024,71.712L676.277,71.712A15.12 15.12 0 0 0 691.397 56.592A15.12 15.12 0 0 0 676.277 41.472L558.024,41.472A15.12 15.12 0 0 0 542.904 56.592A15.12 15.12 0 0 0 558.024 71.712Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 165 |
<text x="617.15" y="56.592" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text> |
| 166 |
<polygon points="759.019,56.592 747.499,60.912 747.499,52.272" style="fill:rgb(0,0,0)"/> |
| 167 |
<path d="M691.397,56.592L753.259,56.592" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 168 |
<path d="M759.019,56.592 L 766.519,56.592 Q 774.019,56.592 774.019,64.092 L 774.019,71.592" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 169 |
<polygon points="617.15,85.32 605.63,89.64 605.63,81" style="fill:rgb(0,0,0)"/> |
| 170 |
<path d="M501.384,85.32L611.39,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 171 |
<path d="M617.15,85.32L800.539,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 172 |
<path d="M659.429,138.24A15.12 15.12 0 0 0 674.549 123.12L674.549,123.12A15.12 15.12 0 0 0 659.429 108A15.12 15.12 0 0 0 644.309 123.12L644.309,123.12A15.12 15.12 0 0 0 659.429 138.24Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 173 |
<text x="659.429" y="123.12" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text> |
| 174 |
<polygon points="674.549,123.12 686.069,118.8 686.069,127.44" style="fill:rgb(0,0,0)"/> |
| 175 |
<path d="M1011.36,85.32 L 1018.86,85.32 Q 1026.36,85.32 1026.36,100.32 L 1026.36,108.12 Q 1026.36,123.12 1011.36,123.12 L 695.309,123.12 L 680.309,123.12" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 176 |
<path d="M644.309,123.12 L 295.982,123.12 Q 280.982,123.12 280.982,108.12 L 280.982,100.32 Q 280.982,85.32 288.482,85.32 L 295.982,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 177 |
<path d="M93.456,85.32L295.982,85.32" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 178 |
</svg> |
| 179 |
</div><br> |
| 180 |
<br></br> |
| 181 |
References: <a href='./cte-table-name.html'>cte-table-name</a> <a href='./select-stmt.html'>select-stmt</a><br></br> |
| 182 |
See also: <a href='../lang_with.html'>lang_with.html</a> |
| 183 |
</div> |
| 184 |
|
| 185 |
|
| 186 |
|