How do I generate a unique, random string for one of my MySql table columns?
<p>I’m using MySql 5.5.37.  I have a table with the following columns</p>

<pre><code>+------------------+------------------+------+-----+---------+-------+
| Field            | Type             | Null | Key | Default | Extra |
+------------------+------------------+------+-----+---------+-------+
| ID               | varchar(32)      | NO   | PRI | NULL    |       |
| CODE             | varchar(6)       | NO   | UNI | NULL    |       |
</code></pre>

<p>The code column is unique and my ID column is a GUID.   I have a number of rows that I would like to update, subject to some criteria in the above table (e.g. WHERE COLUMN1 = 0).  How do I generate random, unique 6-character codes (ideally letters and numbers) for my CODE column such that they don’t violate the unique constraint in my table?  Note that the columns in the table that do not meet the criteria (e.g. Where COLUMN1 &lt;> 0) already have unique values for the CODE column.</p>

<p><b>Edit:</b> This is different than this question -- <a href="https://stackoverflow.com/questions/16737910">Generating a random &amp; unique 8 character string using MySQL</a> because that link deals with IDs taht are numeric.  My IDs are 32-character strings.  Also their solution does not take into account the fact that there may values in the table prior to running the statements I want to run that will generate a unique values for the column in question.</p>