title: How to generate a unique and random number for a primary key in sql
body: <p>I am working on a requirement where I need to generate a unique(non-repeatable) and random number(unpredictable) with atleast 10 digits. I tried <strong>SELECT FLOOR(RAND() * 9999999)</strong>.. but the uniqueness cant be guaranteed with this.
  About 20k values will be inserted per month approx.</p>
  
  <p>Also I want to increment an int column of my table(number_of_hits) for every entry inserted... I am using spring boot to insert values into table.
  Tried <strong>number_of_hits int AUTO_INCREMENT</strong> while creating the table but later got to know this will only work on primary key.. 
  Thanks in advance.!</p>