title: MySQL: How can we dynamically choose an appropriate type?
body: <ol>
  <li>Is there such an opportunity? Let's say, we have a range of integers. We loop over them and find out that they don't exceed 65535. So, now we know that <code>SMALLINT</code> would be a suitable type and are going to create a table with a column of the appropriate type! How can we do this?</li>
  </ol>
  <ol start="2">
  <li>I've tried various combinations like:
  <pre><code>SET @ty := &quot;INT&quot;;
  
  CREATE TABLE tab (
    id @ty
  );
  </code></pre>
  but they all have failed and ended up complaining on <code>@ty</code>.
  So, the other question is whether we can keep in a server script <code>@variable</code> (as <code>INT</code> or as <code>&quot;INT&quot;</code>)?</li>
  </ol>
  <p>Thank you very much for your time!</p>