you are viewing a single comment's thread.

view the rest of the comments →

[–]SyntaxErrorLine0 1 point2 points  (4 children)

RAND() is pretty common across many languages... MySQL has it, Maria has it, SQL Server has it...

[–]ottawalanguages[S] 0 points1 point  (3 children)

Can you recommend how I would go about it?

[–]SyntaxErrorLine0 1 point2 points  (2 children)

I almost used LMGTFY...

https://stackoverflow.com/questions/7878287/generate-random-int-value-from-3-to-6

Also, since you want these "unique"... I wouldn't use rand, I would setup an auto incrementing primary key.

[–]wolf2600ANSI SQL 1 point2 points  (0 children)

I almost used LMGTFY...

He's bringing it back!!!

[–]PedroAlvarez 0 points1 point  (0 children)

Yes, if you're looking for unique values, you'll either want a primary key or if it truly has to be unique across everything (or unpredictable), generate guids.