Last active
March 7, 2018 16:19
-
-
Save jonpemby/a2da452914e7968aebaea8cb60d52939 to your computer and use it in GitHub Desktop.
MySQL random string from list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select elt(floor(1 + (rand() * @len)), "hello", "world", "this", "is", "a", "random", "list"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Edit
Fixed a
NULL
popping up - forgot to useFLOOR
to keep random index within bounds