Skip to content

Instantly share code, notes, and snippets.

@marcelod
Created July 30, 2022 01:53
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 marcelod/89e3bb76dadb78d85b23ed665bbaca21 to your computer and use it in GitHub Desktop.
Save marcelod/89e3bb76dadb78d85b23ed665bbaca21 to your computer and use it in GitHub Desktop.
Número aleatório sql
PARA GERAR UM NUMERO ALEATÓRIO NO SQL
-- ALEATORIO: (ALEATORIO() * (MAX - MIN + 1)) + MIN
-- exemplo de chamada
SELECT FLOOR((RAND() * (100-50+1)) + 50) AS ALEATORIO;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment