Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you just want to display sorted items then you can use order by clause</p> <pre><code>select ids, name from tbles order by name aesc </code></pre> <p>That said, it is not possible to have a permanently sorted database. The database storage does not allow that for the simple reason of storage optimization.</p> <p>To solve your problem, you can extract the data from MySql to a file, sort it by a field(name) and then use a web application to display it. In this method you first would have to identify your sorting method.</p> <p>The best sorting algorithms have the time complexity of <strong>O(NlogN)</strong>. This is the lowest theoretically possible time achievable to sort data in a randomized array (that is an array where elements are likely in random order). Have a look famous algorithms <strong>QuickSort</strong> and <strong>MergeSort</strong>. Decide in basis of whether you want stable sort and your datatype. </p> <p>If you can use Java then you can use <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html" rel="nofollow">Array API</a> for pre-built sort or <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Collections.html" rel="nofollow">Collections</a> sort and writing a comparator for alphabetical ordering (default is natural ordering - ASCII).</p> <p>Now see for any patterns in your input. If you know the pattern of the data in your array (like partially sorted, duplicate values), you can write your own version of MergeSort or QuickSort with minor modifications for faster sort. </p> <p>After this step, if your ids are in millions, then the above algorithms should easily sort it in few minutes. Otherwise for very large dataset(in billions)- you could either split the data and write distributed/parallel code with more machines/cores, or if you have time then just wait for hours(maybe days) on a regular machine.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload