| 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: create-table-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.gif" 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'>create-table-stmt</h1> |
| 119 |
<div class='imgcontainer'> |
| 120 |
<div style="max-width:718px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 718.33 315.792"> |
| 121 |
<circle cx="5" cy="17" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 122 |
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/> |
| 123 |
<path d="M9,17L26,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 124 |
<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);" /> |
| 125 |
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text> |
| 126 |
<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);" /> |
| 127 |
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text> |
| 128 |
<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);" /> |
| 129 |
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text> |
| 130 |
<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);" /> |
| 131 |
<text x="345" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text> |
| 132 |
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/> |
| 133 |
<path d="M116,17L207,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 134 |
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/> |
| 135 |
<path d="M213,17L305,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 136 |
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/> |
| 137 |
<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);" /> |
| 138 |
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/> |
| 139 |
<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);" /> |
| 140 |
<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);" /> |
| 141 |
<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);" /> |
| 142 |
<polygon points="416,17 404,21 404,12" style="fill:rgb(0,0,0)"/> |
| 143 |
<path d="M380,17L410,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 144 |
<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);" /> |
| 145 |
<text x="431" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text> |
| 146 |
<polygon points="469,17 458,21 458,12" style="fill:rgb(0,0,0)"/> |
| 147 |
<path d="M446,17L463,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 148 |
<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);" /> |
| 149 |
<text x="494" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text> |
| 150 |
<polygon points="543,17 531,21 531,12" style="fill:rgb(0,0,0)"/> |
| 151 |
<path d="M520,17L537,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 152 |
<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);" /> |
| 153 |
<text x="580" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text> |
| 154 |
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/> |
| 155 |
<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);" /> |
| 156 |
<polygon points="543,109 554,105 554,113" style="fill:rgb(0,0,0)"/> |
| 157 |
<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);" /> |
| 158 |
<path d="M543,109L310,109" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 159 |
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/> |
| 160 |
<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);" /> |
| 161 |
<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);" /> |
| 162 |
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text> |
| 163 |
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/> |
| 164 |
<path d="M155,147L172,147" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 165 |
<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);" /> |
| 166 |
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text> |
| 167 |
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/> |
| 168 |
<path d="M208,147L238,147" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 169 |
<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);" /> |
| 170 |
<text x="297" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text> |
| 171 |
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/> |
| 172 |
<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);" /> |
| 173 |
<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);" /> |
| 174 |
<polygon points="193,222 205,218 205,227" style="fill:rgb(0,0,0)"/> |
| 175 |
<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);" /> |
| 176 |
<polygon points="28,260 17,265 17,256" style="fill:rgb(0,0,0)"/> |
| 177 |
<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);" /> |
| 178 |
<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);" /> |
| 179 |
<text x="43" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text> |
| 180 |
<polygon points="95,260 83,265 83,256" style="fill:rgb(0,0,0)"/> |
| 181 |
<path d="M59,260L89,260" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 182 |
<path d="M95,275L199,275L199,245L95,245Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 183 |
<text x="147" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text> |
| 184 |
<path d="M253,313L399,313L399,283L253,283Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 185 |
<text x="326" y="298" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-constraint</text> |
| 186 |
<polygon points="399,298 410,294 410,302" style="fill:rgb(0,0,0)"/> |
| 187 |
<path d="M404,298L416,298" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 188 |
<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);" /> |
| 189 |
<text x="431" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text> |
| 190 |
<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);" /> |
| 191 |
<text x="503" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text> |
| 192 |
<polygon points="553,260 541,265 541,256" style="fill:rgb(0,0,0)"/> |
| 193 |
<path d="M518,260L547,260" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 194 |
<path d="M553,275L674,275L674,245L553,245Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 195 |
<text x="613" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-options</text> |
| 196 |
<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);" /> |
| 197 |
<text x="147" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text> |
| 198 |
<polygon points="162,298 174,294 174,302" style="fill:rgb(0,0,0)"/> |
| 199 |
<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);" /> |
| 200 |
<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);" /> |
| 201 |
<polygon points="235,260 224,265 224,256" style="fill:rgb(0,0,0)"/> |
| 202 |
<path d="M199,260L230,260" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 203 |
<polygon points="488,260 476,265 476,256" style="fill:rgb(0,0,0)"/> |
| 204 |
<path d="M235,260L482,260" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 205 |
<polygon points="446,298 458,294 458,302" style="fill:rgb(0,0,0)"/> |
| 206 |
<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);" /> |
| 207 |
<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);" /> |
| 208 |
<polygon points="613,215 602,219 602,211" style="fill:rgb(0,0,0)"/> |
| 209 |
<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);" /> |
| 210 |
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/> |
| 211 |
<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);" /> |
| 212 |
<circle cx="712" cy="215" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 213 |
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/> |
| 214 |
<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);" /> |
| 215 |
<polygon points="440,147 428,151 428,142" style="fill:rgb(0,0,0)"/> |
| 216 |
<path d="M350,147L434,147" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 217 |
<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);" /> |
| 218 |
<text x="457" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text> |
| 219 |
<polygon points="497,147 485,151 485,142" style="fill:rgb(0,0,0)"/> |
| 220 |
<path d="M474,147L491,147" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 221 |
<path d="M497,162L601,162L601,132L497,132Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 222 |
<text x="549" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text> |
| 223 |
<polygon points="637,147 626,151 626,142" style="fill:rgb(0,0,0)"/> |
| 224 |
<path d="M601,147L631,147" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 225 |
<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);" /> |
| 226 |
</svg> |
| 227 |
</div><br> |
| 228 |
|
| 229 |
Used by: <a href='./sql-stmt.html'>sql-stmt</a><br></br> |
| 230 |
References: <a href='./column-def.html'>column-def</a> <a href='./select-stmt.html'>select-stmt</a> <a href='./table-constraint.html'>table-constraint</a> <a href='./table-options.html'>table-options</a><br></br> |
| 231 |
See also: <a href='../lang_createtable.html'>lang_createtable.html</a> |
| 232 |
</div> |
| 233 |
|
| 234 |
|
| 235 |
|