title: Generating all possible unique and random values given conditions in MySQL
body: <p>I'am working on project. There is a person who sends the code under a bottle cap. I want to generate 1 million unique codes for it. The first 3 indexes should be uppercase letters and the last 2 should be number. Actually i want all the values which is 26*26*26*10*10</p>
  
  <p>I tried the code below but it gave me non-unique values. I saw it when i counted.</p>
  
  <pre class="lang-sql prettyprint-override"><code>DELIMITER $$  
    CREATE PROCEDURE randomizer()
      BEGIN
        DECLARE i INT DEFAULT 0 ;
        DECLARE random CHAR(20) ;
        myloop: loop
        SET random=CONCAT(
                                   CHAR(round(rand()*25)+65),
                                   CHAR(round(rand()*25)+65),
                                   CHAR(round(rand()*25)+65),
                                   (round(rand()*25)+65)
  );
        INSERT INTO `passwords` (`pass`) VALUES (i+1,random) ;
        SET i=i+1;
        IF i=1757600‬ THEN
          LEAVE myloop;
      END IF;
      END LOOP myloop;
    END $$
  DELIMITER;
  </code></pre>
  
  <p>I tried to make the column unique key but it showed an error which was <code>1136 - Column count doesn't match value count at row 1</code>. In my code it's generating the codes but they're all not unique.</p>