What is the precedence of characters when sorting in MySQL, PHP, or just in general?

Posted by FireCoding on Stack Overflow See other posts from Stack Overflow or by FireCoding
Published on 2012-06-07T22:20:22Z Indexed on 2012/06/07 22:40 UTC
Read the original article Hit count: 152

Filed under:
|
|
|

Question: Where can I find the precedence of characters when sorting in MySQL, PHP, or just in general on Linux and Windows OS?

For example, everybody knows that a comes before b when performing an ascending sort on a string in MySQL. But what about other characters? Does the dollar-sign $ come before asterisk * ? Does a space come before an exclamation-mark? etc...

What dictates the sort order? Does it use underlying ascii / UTF-8 values? Is it different for different technologies?

Technologies to consider:

  1. Databases - MySQL / SQL / SQLite / Oracle / etc
  2. Programming languages (for string-sorting functions) - PHP / Javascript / ASP.NET / Visual C# / Python / Ruby / Objective C
  3. OS (i.e., sorting files by filename) - Windows / Linux / MacOS / iOS / Android

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript