1
0
Fork 0
cl-sites/sqlite-doc-3440000/syntax/table-constraint.html
2023-11-03 12:08:53 +01:00

232 lines
15 KiB
HTML

<!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: table-constraint</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'>table-constraint</h1>
<div class='imgcontainer'>
<div style="max-width:751px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 751.325 261.36">
<circle cx="5" cy="17" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="110" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONSTRAINT</text>
<polygon points="198,17 187,21 187,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L192,17" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M213,32L240,32A15 15 0 0 0 256 17A15 15 0 0 0 240 2L213,2A15 15 0 0 0 198 17A15 15 0 0 0 213 32Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<path d="M60,108L123,108A15 15 0 0 0 138 92A15 15 0 0 0 123 77L60,77A15 15 0 0 0 45 92A15 15 0 0 0 60 108Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="91" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRIMARY</text>
<polygon points="161,92 149,97 149,88" style="fill:rgb(0,0,0)"/>
<path d="M138,92L155,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M176,108L192,108A15 15 0 0 0 208 92A15 15 0 0 0 192 77L176,77A15 15 0 0 0 161 92A15 15 0 0 0 176 108Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="244,92 232,97 232,88" style="fill:rgb(0,0,0)"/>
<path d="M208,92L238,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,108A15 15 0 0 0 274 92A15 15 0 0 0 259 77A15 15 0 0 0 244 92A15 15 0 0 0 259 108Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="310,92 298,97 298,88" style="fill:rgb(0,0,0)"/>
<path d="M274,92L304,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,108L454,108L454,77L310,77Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="490,92 479,97 479,88" style="fill:rgb(0,0,0)"/>
<path d="M454,92L485,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,108A15 15 0 0 0 521 92A15 15 0 0 0 505 77A15 15 0 0 0 490 92A15 15 0 0 0 505 108Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="505" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="544,92 532,97 532,88" style="fill:rgb(0,0,0)"/>
<path d="M521,92L538,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M544,108L677,108L677,77L544,77Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="610" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="700,92 688,97 688,88" style="fill:rgb(0,0,0)"/>
<path d="M677,92L694,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="741,92 730,97 730,88" style="fill:rgb(0,0,0)"/>
<path d="M700,92L736,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="745" cy="92" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,92 33,97 33,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 31,92 L 39,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="110,55 122,50 122,59" style="fill:rgb(0,0,0)"/>
<path d="M256,17 L 263,17 Q 271,17 271,32 L 271,40 Q 271,55 256,55 L 131,55 L 116,55" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M110,55 L 39,55 Q 24,55 24,62 L 24,70" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,145A15 15 0 0 0 397 130A15 15 0 0 0 382 115A15 15 0 0 0 367 130A15 15 0 0 0 382 145Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="130" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="397,130 409,126 409,135" style="fill:rgb(0,0,0)"/>
<path d="M454,92 L 462,92 Q 469,92 469,107 L 469,115 Q 469,130 454,130 L 418,130 L 403,130" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,130 L 298,130 Q 283,130 283,115 L 283,107 Q 283,92 291,92 L 298,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,145L115,145A15 15 0 0 0 130 130A15 15 0 0 0 115 115L60,115A15 15 0 0 0 45 130A15 15 0 0 0 60 145Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<path d="M130,130 L 208,130 Q 223,130 223,115 L 223,107 Q 223,92 230,92 L 238,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,130 33,135 33,126" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,115 Q 24,130 31,130 L 39,130" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,183L105,183A15 15 0 0 0 121 168A15 15 0 0 0 105 153L60,153A15 15 0 0 0 45 168A15 15 0 0 0 60 183Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CHECK</text>
<polygon points="144,168 132,172 132,164" style="fill:rgb(0,0,0)"/>
<path d="M121,168L138,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M159,183A15 15 0 0 0 174 168A15 15 0 0 0 159 153A15 15 0 0 0 144 168A15 15 0 0 0 159 183Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="168" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="197,168 185,172 185,164" style="fill:rgb(0,0,0)"/>
<path d="M174,168L191,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,183L246,183L246,153L197,153Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="269,168 258,172 258,164" style="fill:rgb(0,0,0)"/>
<path d="M246,168L263,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,183L284,183A15 15 0 0 0 299 168A15 15 0 0 0 284 153L284,153A15 15 0 0 0 269 168A15 15 0 0 0 284 183Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="284" y="168" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="700,168 688,172 688,164" style="fill:rgb(0,0,0)"/>
<path d="M299,168L694,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M700,168 L 707,168 Q 715,168 715,153 L 715,107 Q 715,92 722,92 L 730,92" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,168 33,172 33,164" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,153 Q 24,168 31,168 L 39,168" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,221L123,221A15 15 0 0 0 139 206A15 15 0 0 0 123 191L60,191A15 15 0 0 0 45 206A15 15 0 0 0 60 221Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOREIGN</text>
<polygon points="162,206 150,210 150,201" style="fill:rgb(0,0,0)"/>
<path d="M139,206L156,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,221L193,221A15 15 0 0 0 208 206A15 15 0 0 0 193 191L177,191A15 15 0 0 0 162 206A15 15 0 0 0 177 221Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="231,206 220,210 220,201" style="fill:rgb(0,0,0)"/>
<path d="M208,206L225,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,221A15 15 0 0 0 261 206A15 15 0 0 0 246 191A15 15 0 0 0 231 206A15 15 0 0 0 246 221Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="206" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="297,206 286,210 286,201" style="fill:rgb(0,0,0)"/>
<path d="M261,206L292,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,221L407,221A15 15 0 0 0 422 206A15 15 0 0 0 407 191L313,191A15 15 0 0 0 297 206A15 15 0 0 0 313 221Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="458,206 446,210 446,201" style="fill:rgb(0,0,0)"/>
<path d="M422,206L452,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M473,221A15 15 0 0 0 488 206A15 15 0 0 0 473 191A15 15 0 0 0 458 206A15 15 0 0 0 473 221Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="206" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,206 500,210 500,201" style="fill:rgb(0,0,0)"/>
<path d="M488,206L505,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M511,221L677,221L677,191L511,191Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="594" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-key-clause</text>
<polygon points="700,206 688,210 688,201" style="fill:rgb(0,0,0)"/>
<path d="M677,206L694,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M700,206 L 707,206 Q 715,206 715,191 L 715,168 L 715,153" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,206 33,210 33,201" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,191 Q 24,206 31,206 L 39,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,259A15 15 0 0 0 375 244A15 15 0 0 0 360 228A15 15 0 0 0 345 244A15 15 0 0 0 360 259Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="244" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="375,244 386,239 386,248" style="fill:rgb(0,0,0)"/>
<path d="M422,206 L 429,206 Q 437,206 437,221 L 437,229 Q 437,244 422,244 L 396,244 L 381,244" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,244 L 286,244 Q 271,244 271,229 L 271,221 Q 271,206 278,206 L 286,206" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
Used by:&nbsp;&nbsp; <a href='./create-table-stmt.html'>create-table-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./conflict-clause.html'>conflict-clause</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./foreign-key-clause.html'>foreign-key-clause</a>&nbsp;&nbsp; <a href='./indexed-column.html'>indexed-column</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>