title: Unique key vs Candidate key / Superkey (MySQL)
body: <p>The following SQL code creates two tables, (A) <code>__tableA__</code>, (B) <code>__tableB__</code>. Both tables contain exactly 2 unique keys, named <code>k1</code> and <code>k2</code>.</p>
  
  <pre><code>SHOW VARIABLES WHERE Variable_name = 'version';    # 5.0.51b
  
  CREATE TABLE __tableA__ (`a` INT, `b` INT,
    UNIQUE KEY `k1`(`a`),
    UNIQUE KEY `k2`(`a`,`b`)
  );                                       # Key_name      Column_name
                                           # -------------------------
  SHOW KEYS FROM __tableA__;               # k1            a
                                           # k2            a
                                           # k2            b
  CREATE TABLE __tableB__ (`a` INT,
    UNIQUE KEY `k1`(`a`),
    UNIQUE KEY `k2`(`a`)
  );                                       # Key_name      Column_name
                                           # -------------------------
  SHOW KEYS FROM __tableB__;               # k1            a
                                           # k2            a
  
  DROP TABLE __tableA__;     # cleanup
  DROP TABLE __tableB__;     #
  </code></pre>
  
  <p>As shown by the <code>SHOW KEYS</code> command, the sets of attributes (columns) of keys <code>k1</code> and <code>k2</code> are</p>
  
  <ul>
  <li>A: <code>{a}</code> and <code>{a,b}</code>, respectively,</li>
  <li>B: <code>{a}</code> and <code>{a}</code>, respectively.</li>
  </ul>
  
  <p>This suggests the conclusion that, in MySQL, <b>the concept of <i>unique key</i> does NOT correspond to either of the concepts of <i>candidate key</i> / <i>superkey</i></b>:
  In case (A),  <code>k1</code> and <code>k2</code> cannot be candidate keys because <code>{a} &sub; {a,b}</code> (thus the set of attributes of <code>k2</code> is not minimal).
  In case (B), <code>k1</code> and <code>k2</code> cannot be superkeys because they are different keys with identical sets of attributes.</p>
  
  <p>My <b>question</b>: Is this conclusion correct? If so, which authoritative source does state it clearly?</p>