summaryrefslogtreecommitdiffstats
path: root/www/syntax/alter-table-stmt.html
blob: b1f5bd9540da12d40709c6195f228d73b4e0f72c (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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!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: alter-table-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'>alter-table-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:754px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 754.521 320.904">
<circle cx="5" cy="32" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="37,32 26,37 26,28" style="fill:rgb(0,0,0)"/>
<path d="M9,32L31,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M37,32L59,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47L113,47A15 15 0 0 0 129 32A15 15 0 0 0 113 17L74,17A15 15 0 0 0 59 32A15 15 0 0 0 74 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALTER</text>
<polygon points="165,32 153,37 153,28" style="fill:rgb(0,0,0)"/>
<path d="M129,32L159,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,47L219,47A15 15 0 0 0 234 32A15 15 0 0 0 219 17L180,17A15 15 0 0 0 165 32A15 15 0 0 0 180 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="251,32 240,37 240,28" style="fill:rgb(0,0,0)"/>
<path d="M234,32L245,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="287,32 276,37 276,28" style="fill:rgb(0,0,0)"/>
<path d="M251,32L281,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,47L399,47A15 15 0 0 0 414 32A15 15 0 0 0 399 17L302,17A15 15 0 0 0 287 32A15 15 0 0 0 302 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="436,32 425,37 425,28" style="fill:rgb(0,0,0)"/>
<path d="M414,32L431,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M452,47A15 15 0 0 0 467 32A15 15 0 0 0 452 17A15 15 0 0 0 436 32A15 15 0 0 0 452 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="452" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="503,32 491,37 491,28" style="fill:rgb(0,0,0)"/>
<path d="M467,32L497,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M518,47L593,47A15 15 0 0 0 608 32A15 15 0 0 0 593 17L518,17A15 15 0 0 0 503 32A15 15 0 0 0 518 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="376,6 364,10 364,2" style="fill:rgb(0,0,0)"/>
<path d="M251,32 L 260,32 Q 268,32 268,19 Q 268,6 283,6 L 355,6 L 370,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,6 L 461,6 Q 476,6 476,19 Q 476,32 489,32 L 503,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="626,56 622,45 630,45" style="fill:rgb(0,0,0)"/>
<path d="M608,32 L 617,32 Q 626,32 626,41 L 626,51"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,81 362,76 362,85" style="fill:rgb(0,0,0)"/>
<path d="M626,56 L 626,68 Q 626,81 611,81 L 371,81 L 356,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,81 L 20,81 Q 5,81 5,88 L 5,96"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,126 30,130 30,122" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,111 Q 5,126 20,126 L 20,126 L 36,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,141L117,141A15 15 0 0 0 132 126A15 15 0 0 0 117 111L56,111A15 15 0 0 0 41 126A15 15 0 0 0 56 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RENAME</text>
<polygon points="150,126 139,130 139,122" style="fill:rgb(0,0,0)"/>
<path d="M132,126L144,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,141L171,141A15 15 0 0 0 186 126A15 15 0 0 0 171 111L165,111A15 15 0 0 0 150 126A15 15 0 0 0 165 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="204,126 193,130 193,122" style="fill:rgb(0,0,0)"/>
<path d="M186,126L198,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,141L334,141A15 15 0 0 0 349 126A15 15 0 0 0 334 111L219,111A15 15 0 0 0 204 126A15 15 0 0 0 219 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="277" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">new-table-name</text>
<polygon points="41,171 30,176 30,167" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,156 Q 5,171 20,171 L 21,171 L 36,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,186L117,186A15 15 0 0 0 132 171A15 15 0 0 0 117 156L56,156A15 15 0 0 0 41 171A15 15 0 0 0 56 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RENAME</text>
<polygon points="149,171 138,176 138,167" style="fill:rgb(0,0,0)"/>
<path d="M132,171L143,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="185,171 174,176 174,167" style="fill:rgb(0,0,0)"/>
<path d="M149,171L179,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,186L263,186A15 15 0 0 0 278 171A15 15 0 0 0 263 156L200,156A15 15 0 0 0 185 171A15 15 0 0 0 200 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="314,171 303,176 303,167" style="fill:rgb(0,0,0)"/>
<path d="M278,171L308,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M329,186L423,186A15 15 0 0 0 439 171A15 15 0 0 0 423 156L329,156A15 15 0 0 0 314 171A15 15 0 0 0 329 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="376" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="457,171 445,176 445,167" style="fill:rgb(0,0,0)"/>
<path d="M439,171L451,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,186L477,186A15 15 0 0 0 492 171A15 15 0 0 0 477 156L472,156A15 15 0 0 0 457 171A15 15 0 0 0 472 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="475" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="510,171 499,176 499,167" style="fill:rgb(0,0,0)"/>
<path d="M492,171L505,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,186L660,186A15 15 0 0 0 675 171A15 15 0 0 0 660 156L526,156A15 15 0 0 0 510 171A15 15 0 0 0 526 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">new-column-name</text>
<polygon points="692,171 680,176 680,167" style="fill:rgb(0,0,0)"/>
<path d="M675,171L686,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M692,171 L 700,171 Q 709,171 709,156 L 709,141 Q 709,126 724,126 L 724,126 L 739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="748" cy="126" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M349,126L739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="232,198 220,202 220,193" style="fill:rgb(0,0,0)"/>
<path d="M149,171 L 158,171 Q 166,171 166,184 Q 166,198 181,198 L 211,198 L 226,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="314,171 303,176 303,167" style="fill:rgb(0,0,0)"/>
<path d="M232,198 L 272,198 Q 287,198 287,184 Q 287,171 298,171 L 308,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,232 30,236 30,227" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,217 Q 5,232 20,232 L 21,232 L 36,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,247L76,247A15 15 0 0 0 91 232A15 15 0 0 0 76 217L56,217A15 15 0 0 0 41 232A15 15 0 0 0 56 247Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ADD</text>
<polygon points="108,232 97,236 97,227" style="fill:rgb(0,0,0)"/>
<path d="M91,232L102,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="144,232 133,236 133,227" style="fill:rgb(0,0,0)"/>
<path d="M108,232L138,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M159,247L222,247A15 15 0 0 0 237 232A15 15 0 0 0 222 217L159,217A15 15 0 0 0 144 232A15 15 0 0 0 159 247Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="273,232 262,236 262,227" style="fill:rgb(0,0,0)"/>
<path d="M237,232L267,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,247L378,247L378,217L273,217Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text>
<polygon points="692,232 680,236 680,227" style="fill:rgb(0,0,0)"/>
<path d="M378,232L686,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="191,258 179,262 179,254" style="fill:rgb(0,0,0)"/>
<path d="M108,232 L 117,232 Q 125,232 125,245 Q 125,258 140,258 L 170,258 L 185,258"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,232 262,236 262,227" style="fill:rgb(0,0,0)"/>
<path d="M191,258 L 231,258 Q 246,258 246,245 Q 246,232 257,232 L 267,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M692,232 L 700,232 Q 709,232 709,217 L 709,141 Q 709,126 724,126 L 724,126 L 739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,288 30,292 30,283" style="fill:rgb(0,0,0)"/>
<path d="M5,217 L 5,273 Q 5,288 20,288 L 21,288 L 36,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,303L87,303A15 15 0 0 0 103 288A15 15 0 0 0 87 273L56,273A15 15 0 0 0 41 288A15 15 0 0 0 56 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="72" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="120,288 108,292 108,283" style="fill:rgb(0,0,0)"/>
<path d="M103,288L114,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,288 144,292 144,283" style="fill:rgb(0,0,0)"/>
<path d="M120,288L150,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M171,303L234,303A15 15 0 0 0 249 288A15 15 0 0 0 234 273L171,273A15 15 0 0 0 156 288A15 15 0 0 0 171 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="202" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="285,288 273,292 273,283" style="fill:rgb(0,0,0)"/>
<path d="M249,288L279,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,303L394,303A15 15 0 0 0 409 288A15 15 0 0 0 394 273L300,273A15 15 0 0 0 285 288A15 15 0 0 0 300 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="692,288 680,292 680,283" style="fill:rgb(0,0,0)"/>
<path d="M409,288L686,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M692,288 L 700,288 Q 709,288 709,273 L 709,232 L 709,217"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="202,314 191,318 191,310" style="fill:rgb(0,0,0)"/>
<path d="M120,288 L 127,288 Q 135,288 135,301 Q 135,314 150,314 L 181,314 L 196,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,314 L 245,314 Q 260,314 260,301 Q 260,288 268,288 L 275,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./column-def.html'>column-def</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>
</div>