title: Why this odd index creating with my table when I don't specify it?
body: <p>I want to create table with foreign keys. </p>
  
  <p>This is scheme of this table:</p>
  
  <pre><code>CREATE TABLE `SupplierOrderGoods` (
      `shopOrder_id` INT(11) NOT NULL,
      `supplierGood_id` INT(11) NOT NULL,
      `count` INT(11) NOT NULL,
      PRIMARY KEY (`shopOrder_id`, `supplierGood_id`),
      CONSTRAINT `FK_SupplierOrderGoods_ShopOrders` FOREIGN KEY (`shopOrder_id`) REFERENCES `shoporders` (`id`),
      CONSTRAINT `FK_SupplierOrderGoods_SupplierGoods` FOREIGN KEY (`supplierGood_id`) REFERENCES `suppliergoods` (`id`)
  )
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB;
  </code></pre>
  
  <p>It has two links: to table <code>SupplierGoods</code> — <code>FK_SupplierOrderGoods_SupplierGoods</code> and to table <code>ShopOrders</code> — <code>FK_SupplierOrderGoods_ShopOrders</code>. When I execute this code either in HeidiSQL or in phpMyAdmin odd index <code>FK_SupplierOrderGoods_SupplierGoods</code> is being created.</p>
  
  <p>I don't specify it in my scheme, but it is being created. I realized it when I had seen this in HeidiSQL:</p>
  
  <p><img src="https://i.stack.imgur.com/oqDwt.png" alt="image"></p>
  
  <p>Also, there are possibility to see create-code of the table in heidi:</p>
  
  <pre><code>CREATE TABLE `SupplierOrderGoods` (
      `shopOrder_id` INT(11) NOT NULL,
      `supplierGood_id` INT(11) NOT NULL,
      `count` INT(11) NOT NULL,
      PRIMARY KEY (`shopOrder_id`, `supplierGood_id`),
      ------&gt; INDEX `FK_SupplierOrderGoods_SupplierGoods` (`supplierGood_id`),
      CONSTRAINT `FK_SupplierOrderGoods_ShopOrders` FOREIGN KEY (`shopOrder_id`) REFERENCES `shoporders` (`id`),
      CONSTRAINT `FK_SupplierOrderGoods_SupplierGoods` FOREIGN KEY (`supplierGood_id`) REFERENCES `suppliergoods` (`id`)
  )
  COLLATE='utf8_general_ci'
  ENGINE=InnoDB;
  </code></pre>
  
  <p>I didn't specify <code>INDEX</code>, but it is here. I am scared... Why ? :'(</p>
  
  <p>Why this index appears? I think my heidi is broken, so tried in phpmyadmin, but got same result. </p>
  
  <p>I thinked if it can be correct... but why only 1 index for only 1 field? Why not two indexes if it is correct?</p>
  
  <h2>Update</h2>
  
  <p>Wow! I just realized, that all tables with foreign key has index! I googled it and found <a href="https://stackoverflow.com/questions/836167/does-a-foreign-key-automatically-create-an-index">this</a>. So it it normal, that index is being created with fk, right? </p>
  
  <p>Then, why only 1 index is being created, but not two???</p>