title: Why are chars that start with capital letter sorted before those that start with lower letter?
body: <p>I am doing some basic sorting in <strong>SQL</strong> and I learnt this long time ago: <em>Names that start with capital letters are sorted before names that start with lower letter</em>. Example:</p>
  <pre><code>sqlite&gt; create table letters (letter text);
  sqlite&gt; insert into letters values ('A');
  sqlite&gt; insert into letters values ('C');
  sqlite&gt; insert into letters values ('b');
  sqlite&gt; insert into letters values ('d');
  
  sqlite&gt; select * from letters order by letter asc;
  </code></pre>
  <p>OUTPUT:</p>
  <pre><code>A
  C
  b
  d
  </code></pre>
  <p>In that case, we would instead need to type: <code>sqlite&gt; select * from letters order by letter collate nocase asc;</code>, which would give an expected output of:</p>
  <pre><code>A
  b
  C
  d
  </code></pre>
  <p>But my question is why is it sorted that way? I tried finding an answer, but I failed. My only guess is that ASCII as <strong>&quot;A&quot;=65</strong>, while <strong>&quot;a&quot;=97</strong>. <em>65&lt;97</em>, meaning <code>&quot;A&quot;</code> gets stored before <code>&quot;a&quot;</code>. Does OS really work this way or there is something else I am missing? How does it even work behind the curtain?</p>