| 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: ordering-term</title> |
| 7 |
<!-- path=../ --> |
| 8 |
</head> |
| 9 |
<body> |
| 10 |
<div class=nosearch> |
| 11 |
<a href="../index.html"> |
| 12 |
<img class="logo" src="../images/sqlite370_banner.svg" 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'>ordering-term</h1> |
| 119 |
<div class='imgcontainer'> |
| 120 |
<div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' style='font-size:initial;' class="pikchr" viewBox="0 0 798.451 99.576" data-pikchr-date="20250319161943"> |
| 121 |
<circle cx="5.76" cy="17.28" r="3.6" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 122 |
<polygon points="32.4,17.28 20.88,21.6 20.88,12.96" style="fill:rgb(0,0,0)"/> |
| 123 |
<path d="M9.36,17.28L26.64,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 124 |
<path d="M32.4,32.4L81.5904,32.4L81.5904,2.16L32.4,2.16Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 125 |
<text x="56.9952" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text> |
| 126 |
<polygon points="111.59,44.496 100.07,48.816 100.07,40.176" style="fill:rgb(0,0,0)"/> |
| 127 |
<path d="M81.5904,17.28 L 89.0904,17.28 Q 96.5904,17.28 96.5904,30.888 Q 96.5904,44.496 101.21,44.496 L 105.83,44.496" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 128 |
<path d="M126.71,59.616L190.819,59.616A15.12 15.12 0 0 0 205.939 44.496L205.939,44.496A15.12 15.12 0 0 0 190.819 29.376L126.71,29.376A15.12 15.12 0 0 0 111.59 44.496L111.59,44.496A15.12 15.12 0 0 0 126.71 59.616Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 129 |
<text x="158.765" y="44.496" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text> |
| 130 |
<polygon points="228.979,44.496 217.459,48.816 217.459,40.176" style="fill:rgb(0,0,0)"/> |
| 131 |
<path d="M205.939,44.496L223.219,44.496" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 132 |
<path d="M244.099,59.616L349.45,59.616A15.12 15.12 0 0 0 364.57 44.496L364.57,44.496A15.12 15.12 0 0 0 349.45 29.376L244.099,29.376A15.12 15.12 0 0 0 228.979 44.496L228.979,44.496A15.12 15.12 0 0 0 244.099 59.616Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 133 |
<text x="296.774" y="44.496" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text> |
| 134 |
<polygon points="406.09,17.28 394.57,21.6 394.57,12.96" style="fill:rgb(0,0,0)"/> |
| 135 |
<path d="M364.57,44.496 L 372.07,44.496 Q 379.57,44.496 379.57,30.888 Q 379.57,17.28 389.95,17.28 L 400.33,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 136 |
<polygon points="243.84,17.28 232.32,21.6 232.32,12.96" style="fill:rgb(0,0,0)"/> |
| 137 |
<path d="M81.5904,17.28L238.08,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 138 |
<path d="M243.84,17.28L394.57,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 139 |
<polygon points="447.61,82.296 436.09,86.616 436.09,77.976" style="fill:rgb(0,0,0)"/> |
| 140 |
<path d="M406.09,17.28 L 413.59,17.28 Q 421.09,17.28 421.09,32.28 L 421.09,67.296 Q 421.09,82.296 431.47,82.296 L 441.85,82.296" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 141 |
<path d="M462.73,97.416L492.97,97.416A15.12 15.12 0 0 0 508.09 82.296A15.12 15.12 0 0 0 492.97 67.176L462.73,67.176A15.12 15.12 0 0 0 447.61 82.296A15.12 15.12 0 0 0 462.73 97.416Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 142 |
<text x="477.85" y="82.296" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text> |
| 143 |
<polygon points="549.61,17.28 538.09,21.6 538.09,12.96" style="fill:rgb(0,0,0)"/> |
| 144 |
<path d="M508.09,82.296 L 515.59,82.296 Q 523.09,82.296 523.09,67.296 L 523.09,32.28 Q 523.09,17.28 533.47,17.28 L 543.85,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 145 |
<path d="M462.73,59.616L479.376,59.616A15.12 15.12 0 0 0 494.496 44.496L494.496,44.496A15.12 15.12 0 0 0 479.376 29.376L462.73,29.376A15.12 15.12 0 0 0 447.61 44.496L447.61,44.496A15.12 15.12 0 0 0 462.73 59.616Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 146 |
<text x="471.053" y="44.496" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text> |
| 147 |
<polygon points="447.61,44.496 436.09,48.816 436.09,40.176" style="fill:rgb(0,0,0)"/> |
| 148 |
<path d="M421.09,29.376 L 421.09,36.936 Q 421.09,44.496 431.47,44.496 L 441.85,44.496" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 149 |
<path d="M494.496,44.496 L 508.793,44.496 Q 523.09,44.496 523.09,36.996 L 523.09,29.496" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 150 |
<polygon points="477.85,17.28 466.33,21.6 466.33,12.96" style="fill:rgb(0,0,0)"/> |
| 151 |
<path d="M406.09,17.28L472.09,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 152 |
<path d="M477.85,17.28L538.09,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 153 |
<polygon points="591.13,44.496 579.61,48.816 579.61,40.176" style="fill:rgb(0,0,0)"/> |
| 154 |
<path d="M549.61,17.28 L 557.11,17.28 Q 564.61,17.28 564.61,30.888 Q 564.61,44.496 574.99,44.496 L 585.37,44.496" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 155 |
<path d="M606.25,59.616L648.355,59.616A15.12 15.12 0 0 0 663.475 44.496L663.475,44.496A15.12 15.12 0 0 0 648.355 29.376L606.25,29.376A15.12 15.12 0 0 0 591.13 44.496L591.13,44.496A15.12 15.12 0 0 0 606.25 59.616Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 156 |
<text x="627.302" y="44.496" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text> |
| 157 |
<polygon points="686.515,44.496 674.995,48.816 674.995,40.176" style="fill:rgb(0,0,0)"/> |
| 158 |
<path d="M663.475,44.496L680.755,44.496" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 159 |
<path d="M701.635,59.616L735.331,59.616A15.12 15.12 0 0 0 750.451 44.496L750.451,44.496A15.12 15.12 0 0 0 735.331 29.376L701.635,29.376A15.12 15.12 0 0 0 686.515 44.496L686.515,44.496A15.12 15.12 0 0 0 701.635 59.616Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 160 |
<text x="718.483" y="44.496" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text> |
| 161 |
<polygon points="791.971,17.28 780.451,21.6 780.451,12.96" style="fill:rgb(0,0,0)"/> |
| 162 |
<path d="M750.451,44.496 L 757.951,44.496 Q 765.451,44.496 765.451,30.888 Q 765.451,17.28 775.831,17.28 L 786.211,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 163 |
<path d="M606.25,97.416L648.355,97.416A15.12 15.12 0 0 0 663.475 82.296A15.12 15.12 0 0 0 648.355 67.176L606.25,67.176A15.12 15.12 0 0 0 591.13 82.296A15.12 15.12 0 0 0 606.25 97.416Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 164 |
<text x="627.302" y="82.296" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text> |
| 165 |
<polygon points="686.515,82.296 674.995,86.616 674.995,77.976" style="fill:rgb(0,0,0)"/> |
| 166 |
<path d="M663.475,82.296L680.755,82.296" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 167 |
<path d="M701.635,97.416L727.728,97.416A15.12 15.12 0 0 0 742.848 82.296A15.12 15.12 0 0 0 727.728 67.176L701.635,67.176A15.12 15.12 0 0 0 686.515 82.296A15.12 15.12 0 0 0 701.635 97.416Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 168 |
<text x="714.682" y="82.296" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text> |
| 169 |
<polygon points="591.13,82.296 579.61,86.616 579.61,77.976" style="fill:rgb(0,0,0)"/> |
| 170 |
<path d="M564.61,29.376 L 564.61,67.296 Q 564.61,82.296 574.99,82.296 L 585.37,82.296" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 171 |
<path d="M742.848,82.296 L 754.15,82.296 Q 765.451,82.296 765.451,67.296 L 765.451,44.376 L 765.451,29.376" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 172 |
<polygon points="670.79,17.28 659.27,21.6 659.27,12.96" style="fill:rgb(0,0,0)"/> |
| 173 |
<path d="M549.61,17.28L665.03,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 174 |
<path d="M670.79,17.28L780.451,17.28" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" /> |
| 175 |
</svg> |
| 176 |
</div><br> |
| 177 |
|
| 178 |
Used by: <a href='./aggregate-function-invocation.html'>aggregate-function-invocation</a> <a href='./compound-select-stmt.html'>compound-select-stmt</a> <a href='./delete-stmt-limited.html'>delete-stmt-limited</a> <a href='./factored-select-stmt.html'>factored-select-stmt</a> <a href='./function-arguments.html'>function-arguments</a> <a href='./over-clause.html'>over-clause</a> <a href='./select-stmt.html'>select-stmt</a> <a href='./simple-select-stmt.html'>simple-select-stmt</a> <a href='./update-stmt-limited.html'>update-stmt-limited</a> <a href='./window-defn.html'>window-defn</a><br></br> |
| 179 |
References: <a href='./expr.html'>expr</a><br></br> |
| 180 |
See also: <a href='../lang_aggfunc.html'>lang_aggfunc.html</a> <a href='../lang_altertable.html'>lang_altertable.html</a> <a href='../lang_attach.html'>lang_attach.html</a> <a href='../lang_createindex.html'>lang_createindex.html</a> <a href='../lang_createtable.html'>lang_createtable.html</a> <a href='../lang_createtrigger.html'>lang_createtrigger.html</a> <a href='../lang_createview.html'>lang_createview.html</a> <a href='../lang_delete.html'>lang_delete.html</a> <a href='../lang_expr.html'>lang_expr.html</a> <a href='../lang_insert.html'>lang_insert.html</a> <a href='../lang_returning.html'>lang_returning.html</a> <a href='../lang_select.html'>lang_select.html</a> <a href='../lang_update.html'>lang_update.html</a> <a href='../lang_upsert.html'>lang_upsert.html</a> <a href='../lang_with.html'>lang_with.html</a> <a href='../partialindex.html'>partialindex.html</a> |
| 181 |
</div> |
| 182 |
|
| 183 |
|
| 184 |
|