summaryrefslogtreecommitdiffstats
path: root/www/syntax/create-table-stmt.html
blob: eb02af9972c15fbb7d598b83d02b4235b84c77cc (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
<!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: create-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'>create-table-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:718px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 718.33 315.792">
<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);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L365,32A15 15 0 0 0 380 17A15 15 0 0 0 365 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="416,17 404,21 404,12" style="fill:rgb(0,0,0)"/>
<path d="M380,17L410,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,32A15 15 0 0 0 446 17A15 15 0 0 0 431 2A15 15 0 0 0 416 17A15 15 0 0 0 431 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="431" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="469,17 458,21 458,12" style="fill:rgb(0,0,0)"/>
<path d="M446,17L463,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M484,32L504,32A15 15 0 0 0 520 17A15 15 0 0 0 504 2L484,2A15 15 0 0 0 469 17A15 15 0 0 0 484 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="494" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="543,17 531,21 531,12" style="fill:rgb(0,0,0)"/>
<path d="M520,17L537,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32L602,32A15 15 0 0 0 617 17A15 15 0 0 0 602 2L558,2A15 15 0 0 0 543 17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="580" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M380,17 L 387,17 Q 395,17 395,32 L 395,94 Q 395,109 380,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="543,109 554,105 554,113" style="fill:rgb(0,0,0)"/>
<path d="M617,17 L 625,17 Q 632,17 632,32 L 632,94 Q 632,109 617,109 L 563,109 L 548,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M543,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L334,162A15 15 0 0 0 350 147A15 15 0 0 0 334 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 205,177 Q 220,177 220,162 L 220,162 Q 220,147 227,147 L 235,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="193,222 205,218 205,227" style="fill:rgb(0,0,0)"/>
<path d="M350,147 L 357,147 Q 365,147 365,162 L 365,207 Q 365,222 350,222 L 214,222 L 199,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,260 17,265 17,256" style="fill:rgb(0,0,0)"/>
<path d="M193,222 L 20,222 Q 5,222 5,237 L 5,245 Q 5,260 14,260 L 23,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,275A15 15 0 0 0 59 260A15 15 0 0 0 43 245A15 15 0 0 0 28 260A15 15 0 0 0 43 275Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="43" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="95,260 83,265 83,256" style="fill:rgb(0,0,0)"/>
<path d="M59,260L89,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,275L199,275L199,245L95,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="147" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text>
<path d="M253,313L399,313L399,283L253,283Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="298" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-constraint</text>
<polygon points="399,298 410,294 410,302" style="fill:rgb(0,0,0)"/>
<path d="M404,298L416,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,313A15 15 0 0 0 446 298A15 15 0 0 0 431 283A15 15 0 0 0 416 298A15 15 0 0 0 431 313Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="431" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M503,275A15 15 0 0 0 518 260A15 15 0 0 0 503 245A15 15 0 0 0 488 260A15 15 0 0 0 503 275Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="503" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="553,260 541,265 541,256" style="fill:rgb(0,0,0)"/>
<path d="M518,260L547,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M553,275L674,275L674,245L553,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="613" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-options</text>
<path d="M147,313A15 15 0 0 0 162 298A15 15 0 0 0 147 283A15 15 0 0 0 132 298A15 15 0 0 0 147 313Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="147" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="162,298 174,294 174,302" style="fill:rgb(0,0,0)"/>
<path d="M199,260 L 207,260 Q 214,260 214,275 L 214,283 Q 214,298 199,298 L 183,298 L 168,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,298 L 87,298 Q 72,298 72,283 L 72,275 Q 72,260 77,260 L 83,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="235,260 224,265 224,256" style="fill:rgb(0,0,0)"/>
<path d="M199,260L230,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="488,260 476,265 476,256" style="fill:rgb(0,0,0)"/>
<path d="M235,260L482,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,298 458,294 458,302" style="fill:rgb(0,0,0)"/>
<path d="M446,260 L 458,260 Q 469,260 469,275 L 469,283 Q 469,298 460,298 L 452,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,298 L 246,298 Q 238,298 238,283 L 238,275 Q 238,260 250,260 L 261,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,215 602,219 602,211" style="fill:rgb(0,0,0)"/>
<path d="M518,260 L 526,260 Q 533,260 533,245 L 533,230 Q 533,215 548,215 L 592,215 L 607,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/>
<path d="M613,215 L 659,215 Q 674,215 688,215 L 703,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="712" cy="215" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/>
<path d="M674,260 L 681,260 Q 689,260 689,245 L 689,230 Q 689,215 696,215 L 703,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,147 428,151 428,142" style="fill:rgb(0,0,0)"/>
<path d="M350,147L434,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,162L459,162A15 15 0 0 0 474 147A15 15 0 0 0 459 132L455,132A15 15 0 0 0 440 147A15 15 0 0 0 455 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="497,147 485,151 485,142" style="fill:rgb(0,0,0)"/>
<path d="M474,147L491,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M497,162L601,162L601,132L497,132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="549" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="637,147 626,151 626,142" style="fill:rgb(0,0,0)"/>
<path d="M601,147L631,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M637,147 L 674,147 Q 689,147 689,162 L 689,200 Q 689,215 696,215 L 704,215"  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>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./table-constraint.html'>table-constraint</a>&nbsp;&nbsp; <a href='./table-options.html'>table-options</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>