How do I generate UNIQUE random numbers within a range?

Let’s say for every new entry I make in my app, I want to generate a random 6 digit number for a column.

So for example, if I create one entry, I would get a number like 568392.

HOWEVER, I don’t want 568392 to show up again in that column on the table. I want all the numbers generated to be unique. I tried RANDBETWEEN(100000, 999999) but I don’t think that prevents duplicates. Any help?

1 2 2,690
2 REPLIES 2
Top Labels in this Space