title: How to solve a error "Foreign key constraint is incorrectly formed" on CREATE TABLE
body: <p>Can someone spot where is the error on the following <code>CREATE TABLE</code>?</p>
  <p>MariaDB 10.4.13 keeps telling me there is some problem with foreign key.</p>
  <p>The command:</p>
  <pre><code>CREATE TABLE sf_rel_places_esp_sisjud (
    j_esp_id SMALLINT(5) UNSIGNED NOT NULL,
    j_sisjud_id MEDIUMINT(8) UNSIGNED NOT NULL,
    FOREIGN KEY (j_esp_id) REFERENCES sf_j_esp (id),
    FOREIGN KEY (j_sisjud_id) REFERENCES sf_j_sisjud (id))
  </code></pre>
  <p>The error response:</p>
  <pre><code>Error Code: 1005. Can't create table `u4599448`.`sf_rel_places_esp_sisjud`
  (errno: 150 &quot;Foreign key constraint is incorrectly formed&quot;)
  </code></pre>