samedi 24 décembre 2016

about mysql excute order by 1 and rand(1)?

In mysql I built a table, which id is int type, name and password is varchar type. excute

select * from test.new_table order by rand(1);

then the result is: enter image description here

This is because after set seed for rand the sequence is fixed, I already know.But if excute

select * from test.new_table order by 1 and rand(1);

then the result is: enter image description here

For such a result I do not understand. In addition, if excute order by 'xxx' the results are arranged. Not quite understand, hope you to give pointers.




Aucun commentaire:

Enregistrer un commentaire