title: Normalize a table with a two-column primary key and one other column
body: <p>My <code>DataTable</code> has 3 columns: A, B and C. None are guaranteed to have unique entries, in non-trivial cases every column will have non-unique entries.</p>
  
  <p>The combination of {A, B} <em>is</em> guaranteed to be unique. Because ADO.NET <code>DataTable</code> allows using multiple columns as the primary key, I use A and B as my primary key.</p>
  
  <p>A vs B represents a matrix with 0 as the default value, so it's possible for me to guarantee that entries of B will come from a finite pool and for each entry of A, every possible {A, B} will appear (ie such that there will be exactly <code>number of unique A values * number of unique B values</code> rows in the table).</p>
  
  <p>My question has two parts:</p>
  
  <p>1) How to normalize this so that I have one key and no update anomalies (I'm not sure but I think I want a <a href="https://en.wikipedia.org/wiki/Third_normal_form" rel="nofollow">3NF</a>)? (Unless I am mistaken, simply adding an extra "ID" column with non-redundant integers will allow update anomalies)</p>
  
  <p>2) How to set it up (in C# using the ADO.NET library) so that whenever I want to add a row, I specify entries of B and C, and then it automatically generates a suitable value of A, so that I can "insert C at {A, B}"? A can be an integer or a string.</p>
  
  <p>The two are related, since your answer for 2 may affect 1 and vice versa.</p>