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: 150
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:
- Databases - MySQL / SQL / SQLite / Oracle / etc
- Programming languages (for string-sorting functions) - PHP / Javascript / ASP.NET / Visual C# / Python / Ruby / Objective C
- OS (i.e., sorting files by filename) - Windows / Linux / MacOS / iOS / Android
© Stack Overflow or respective owner