title: Create table of unique foreign keys
body: <p>I am using MySQL and I have two tables of the form :  </p>
  
  <pre><code>mysql&gt; describe ing_categories;
  +-------------+------------------+------+-----+---------+----------------+
  | Field       | Type             | Null | Key | Default | Extra          |
  +-------------+------------------+------+-----+---------+----------------+
  | ID_Category | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
  | category    | varchar(64)      | NO   | UNI | NULL    |                |
  +-------------+------------------+------+-----+---------+----------------+
  2 rows in set (0.00 sec)
  
  mysql&gt; describe ing_titles;
  +----------+------------------+------+-----+---------+----------------+
  | Field    | Type             | Null | Key | Default | Extra          |
  +----------+------------------+------+-----+---------+----------------+
  | ID_Title | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
  | title    | varchar(128)     | NO   | UNI | NULL    |                |
  +----------+------------------+------+-----+---------+----------------+
  2 rows in set (0.00 sec)  
  </code></pre>
  
  <p>I have a third table containing foreign key records, the foreign keys are to the above tables:  </p>
  
  <pre><code>mysql&gt; describe ing_title_categories;
  +-------------------+------------------+------+-----+---------+----------------+
  | Field             | Type             | Null | Key | Default | Extra          |
  +-------------------+------------------+------+-----+---------+----------------+
  | ID_Title_Category | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
  | ID_Title          | int(10) unsigned | NO   | MUL | NULL    |                |
  | ID_Category       | int(10) unsigned | NO   | MUL | NULL    |                |
  +-------------------+------------------+------+-----+---------+----------------+  
  </code></pre>
  
  <p>How do I create the <code>ing_titles_categories</code> table so that the <em>pair</em> of foreign keys is unique?  </p>
  
  <p>Here is my SQL statement:  </p>
  
  <pre><code>CREATE TABLE ing_title_categories
  (
      ID_Title_Category INTEGER UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
      ID_Title INTEGER UNSIGNED NOT NULL,
      ID_Category INTEGER UNSIGNED NOT NULL,
      FOREIGN KEY fk_title(ID_Title)
          REFERENCES ing_titles(ID_Title)
          ON UPDATE CASCADE
          ON DELETE RESTRICT,
      FOREIGN KEY fk_category(ID_Category)
          REFERENCES ing_categories(ID_Category)
          ON UPDATE CASCADE
          ON DELETE RESTRICT
  ) ENGINE=InnoDB;
  </code></pre>
  
  <p>I've searched other questions and they involve making an index for the foreign keys; but I don't want to index by the foreign keys, I want the constraint to be <code>unique</code> <strong>for the pair of foreign keys</strong>.</p>
  
  <p><em>Tools:</em><br>
  MySQL Server version: 5.6.26</p>
  
  <p><em>Notes:</em> </p>
  
  <ol>
  <li>I am not using PHP, but C++ via MySQL C++ Connector, so please no PHP
  examples.</li>
  </ol>