Skip to content

Instantly share code, notes, and snippets.

@wriglz
Created September 7, 2022 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wriglz/74e8109c01485b9b96c60aca67ec9dcf to your computer and use it in GitHub Desktop.
Save wriglz/74e8109c01485b9b96c60aca67ec9dcf to your computer and use it in GitHub Desktop.
SQL to generate a random number within a specified <min> <max> range
-- Generate a random number within a specified <min> <max> range
SELECT
CAST(<min> + RAND() * (<max> - <min>) AS INT) AS random_number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment