NATURAL_SORT_KEY
Generate a sort key for natural ordering. This function produces a key that allows strings containing numbers to be sorted in a human-readable order.
Syntax
NATURAL_SORT_KEY(str)Description
Examples
Strings and Numbers
CREATE TABLE t1 (c TEXT);
INSERT INTO t1 VALUES ('b1'),('a2'),('a11'),('a1');
SELECT c FROM t1;
+------+
| c |
+------+
| b1 |
| a2 |
| a11 |
| a1 |
+------+
SELECT c FROM t1 ORDER BY c;
+------+
| c |
+------+
| a1 |
| a11 |
| a2 |
| b1 |
+------+IPs
Generated Columns
Leading Zeroes
Last updated
Was this helpful?

