summaryrefslogtreecommitdiffstats
path: root/www/syntax/upsert-clause.html
blob: 739ab66a6de2d6e4f783c8524b8e228988164dbf (plain)
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
<!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: upsert-clause</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'>upsert-clause</h1>
<div class='imgcontainer'>
<div style="max-width:901px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 901.142 363.96">
<path d="M223,165L759,165L759,51L223,51Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="5" cy="66" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,66 35,71 35,62" style="fill:rgb(0,0,0)"/>
<path d="M9,66L41,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,82L71,82A15 15 0 0 0 86 66A15 15 0 0 0 71 51L62,51A15 15 0 0 0 47 66A15 15 0 0 0 62 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="103,66 92,71 92,62" style="fill:rgb(0,0,0)"/>
<path d="M86,66L98,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M118,82L193,82A15 15 0 0 0 208 66A15 15 0 0 0 193 51L118,51A15 15 0 0 0 103 66A15 15 0 0 0 118 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="264,97 253,101 253,92" style="fill:rgb(0,0,0)"/>
<path d="M208,66 L 223,66 Q 238,66 238,81 L 238,82 Q 238,97 248,97 L 259,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,112A15 15 0 0 0 295 97L295,97A15 15 0 0 0 280 82A15 15 0 0 0 264 97L264,97A15 15 0 0 0 280 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="331,97 319,101 319,92" style="fill:rgb(0,0,0)"/>
<path d="M295,97L325,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M331,112L475,112L475,82L331,82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="511,97 500,101 500,92" style="fill:rgb(0,0,0)"/>
<path d="M475,97L506,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,112A15 15 0 0 0 542 97L542,97A15 15 0 0 0 526 82A15 15 0 0 0 511 97L511,97A15 15 0 0 0 526 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="526" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="583,135 572,139 572,130" style="fill:rgb(0,0,0)"/>
<path d="M542,97 L 549,97 Q 557,97 557,112 L 557,119 Q 557,135 567,135 L 577,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M598,150L648,150A15 15 0 0 0 663 135A15 15 0 0 0 648 119L598,119A15 15 0 0 0 583 135A15 15 0 0 0 598 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="623" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="680,135 669,139 669,130" style="fill:rgb(0,0,0)"/>
<path d="M663,135L674,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M680,150L729,150L729,119L680,119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="744,108 749,119 740,119" style="fill:rgb(0,0,0)"/>
<path d="M729,135 L 737,135 Q 744,135 744,124 L 744,114"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="786,66 774,71 774,62" style="fill:rgb(0,0,0)"/>
<path d="M744,108 L 744,81 Q 744,66 759,66 L 765,66 L 780,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M801,82L809,82A15 15 0 0 0 824 66A15 15 0 0 0 809 51L801,51A15 15 0 0 0 786 66A15 15 0 0 0 801 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="805" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DO</text>
<polygon points="729,97 718,101 718,92" style="fill:rgb(0,0,0)"/>
<path d="M542,97L723,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,97 L 737,97 Q 744,97 744,89 L 744,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,66L774,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,150A15 15 0 0 0 418 135A15 15 0 0 0 403 119A15 15 0 0 0 388 135A15 15 0 0 0 403 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,135 430,130 430,139" style="fill:rgb(0,0,0)"/>
<path d="M475,97 L 483,97 Q 490,97 490,112 L 490,119 Q 490,135 475,135 L 439,135 L 424,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,135 L 319,135 Q 304,135 304,119 L 304,112 Q 304,97 312,97 L 319,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="288" y="36" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" dominant-baseline="central">conflict target</text>
<polygon points="436,195 447,191 447,199" style="fill:rgb(0,0,0)"/>
<path d="M824,66 L 831,66 Q 839,66 839,81 L 839,180 Q 839,195 824,195 L 456,195 L 441,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,271 35,275 35,266" style="fill:rgb(0,0,0)"/>
<path d="M436,195 L 35,195 Q 20,195 20,210 L 20,256 Q 20,271 31,271 L 41,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,286L116,286A15 15 0 0 0 131 271A15 15 0 0 0 116 255L62,255A15 15 0 0 0 47 271A15 15 0 0 0 62 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="148,271 137,275 137,266" style="fill:rgb(0,0,0)"/>
<path d="M131,271L143,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,286L179,286A15 15 0 0 0 194 271A15 15 0 0 0 179 255L164,255A15 15 0 0 0 148 271A15 15 0 0 0 164 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="171" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="257,308 245,313 245,304" style="fill:rgb(0,0,0)"/>
<path d="M194,271 L 215,271 Q 230,271 230,286 L 230,293 Q 230,308 241,308 L 251,308"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,324L413,324L413,293L257,293Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="335" y="308" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="475,271 464,275 464,266" style="fill:rgb(0,0,0)"/>
<path d="M413,308 L 434,308 Q 449,308 449,293 L 449,286 Q 449,271 459,271 L 469,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,286A15 15 0 0 0 505 271A15 15 0 0 0 490 255A15 15 0 0 0 475 271A15 15 0 0 0 490 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="523,271 511,275 511,266" style="fill:rgb(0,0,0)"/>
<path d="M505,271L517,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M523,286L572,286L572,255L523,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="547" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="619,271 608,275 608,266" style="fill:rgb(0,0,0)"/>
<path d="M572,271L613,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M634,286L684,286A15 15 0 0 0 699 271A15 15 0 0 0 684 255L634,255A15 15 0 0 0 619 271A15 15 0 0 0 634 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="716,271 705,275 705,266" style="fill:rgb(0,0,0)"/>
<path d="M699,271L710,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M716,286L765,286L765,255L716,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="741" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="891,233 880,237 880,228" style="fill:rgb(0,0,0)"/>
<path d="M765,271 L 773,271 Q 780,271 780,256 L 780,248 Q 780,233 795,233 L 871,233 L 886,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="895" cy="233" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,248L130,248A15 15 0 0 0 145 233A15 15 0 0 0 130 218L62,218A15 15 0 0 0 47 233A15 15 0 0 0 62 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="96" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTHING</text>
<polygon points="47,233 35,237 35,228" style="fill:rgb(0,0,0)"/>
<path d="M20,218 L 20,225 Q 20,233 31,233 L 41,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,233L880,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,233 626,237 626,228" style="fill:rgb(0,0,0)"/>
<path d="M587,271 L 594,271 Q 602,271 602,256 L 602,248 Q 602,233 617,233 L 617,233 L 632,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,361A15 15 0 0 0 398 346A15 15 0 0 0 383 331A15 15 0 0 0 368 346A15 15 0 0 0 383 361Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="383" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="398,346 410,342 410,351" style="fill:rgb(0,0,0)"/>
<path d="M572,271 L 579,271 Q 587,271 587,286 L 587,331 Q 587,346 572,346 L 419,346 L 404,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,308 210,320 201,320" style="fill:rgb(0,0,0)"/>
<path d="M368,346 L 221,346 Q 206,346 206,331 L 206,329 L 206,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,308 L 206,286 Q 206,271 221,271 L 227,271 L 242,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="257,271 245,275 245,266" style="fill:rgb(0,0,0)"/>
<path d="M194,271L251,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,286L366,286A15 15 0 0 0 381 271A15 15 0 0 0 366 255L272,255A15 15 0 0 0 257 271A15 15 0 0 0 272 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M381,271L464,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="865,97 869,108 860,108" style="fill:rgb(0,0,0)"/>
<path d="M850,233 L 857,233 Q 865,233 865,218 L 865,117 L 865,102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="403,6 415,2 415,10" style="fill:rgb(0,0,0)"/>
<path d="M865,97 L 865,21 Q 865,6 850,6 L 424,6 L 409,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,6 L 40,6 Q 25,6 25,21 L 25,51 Q 25,66 32,66 L 40,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./insert-stmt.html'>insert-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./column-name-list.html'>column-name-list</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./indexed-column.html'>indexed-column</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>
</div>