clear markdown help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1579714 fiddles created (21363 in the last week).

select version();
version()
8.0.20
version()
8.0.20
 hidden batch(es)


CREATE TABLE a (x INT, f char(255) default 'xxxxxxxxxxx', INDEX(x));
 hidden batch(es)


INSERT INTO a (x) VALUES (4), (3), (1), (2), (0) ;
 hidden batch(es)


select x from a ; -- Field x is a key, so MySQL sorts by that key when a SELECT is done -- on that field only!
x
0
1
2
3
4
x
0
1
2
3
4
 hidden batch(es)


SELECT * FROM a; -- Compare with this where the sort is by the implicit PK, -- i.e. INSERT order if no ORDER BY is specified!
x f
4 xxxxxxxxxxx
3 xxxxxxxxxxx
1 xxxxxxxxxxx
2 xxxxxxxxxxx
0 xxxxxxxxxxx
x f
4 xxxxxxxxxxx
3 xxxxxxxxxxx
1 xxxxxxxxxxx
2 xxxxxxxxxxx
0 xxxxxxxxxxx
 hidden batch(es)