Answers for "how to generate a unique random number in mysql"

SQL
0

how to generate a unique random number in mysql

#query 
SELECT FLOOR(RAND() * 99999)
AS random_num 
FROM YourTableName
WHERE "random_num" 
NOT IN (
  SELECT YourColumnName FROM YourTableName) LIMIT 1
Posted by: Guest on May-18-2021
0

generate random & unique mysql string

DO 
    SELECT LEFT(UUID(), 8) INTO @var;
    INSERT INTO col (@var);
WHILE there_is_a_unique_constraint_violation
Posted by: Guest on April-06-2020

Code answers related to "how to generate a unique random number in mysql"

Code answers related to "SQL"

Browse Popular Code Answers by Language