SQL insert using RAND() for inserting random value - INSERT into TINYINT?
<p>I have a MySQL Insert and I am using <code>RAND</code> to generate a random <code>INT</code> value the issue is it wont insert into the DB as the column accepts <code>TINYINT</code>, How can I convert the output to <code>TINYINT</code>. Code example Below:</p>

<pre><code>INSERT INTO table (`col`, `col` VALUES (NULL, CAST(FLOOR(5+RAND()*(1-5)) AS CHAR);
</code></pre>

<p>So I want to randomly insert a number between 1 and 5 which works, however, because the column is set to <code>TINYINT</code> and not <code>INT</code> i get 1592 unsafe statement. And the DB sets the col to its default value 1.</p>

<p>How can I use <code>RAND</code> to enter a random value through using an <code>INSERT INTO</code> a <code>TINYINT</code> col?</p>