title: MySQL: Auto incrementing combined keys
body: <p>Ok, I have a table that will look something like this:</p>
  
  <pre><code>Post
   ˪ Id
   ˪ Version
   ˪ Title
   ˪ Content
  </code></pre>
  
  <p>The idea is that the Id and Version together will be the primary key since you can have a single post multiple times but of different versions.</p>
  
  <p>My question is this: I would like to have the Id to auto increment. Is this possible in a setup like this? Will things be messed up when I insert the second version of a post for example?</p>
  
  <hr>
  
  <p>Seems like I need to clear some things up here. What I would like is to do something like this:</p>
  
  <pre><code>INSERT INTO posts VALUES (NULL, 0, "A title", "Some content");
  </code></pre>
  
  <p>That would create a new post with some auto incremented id. Let's say it got the id 7. I now want to create a new version:</p>
  
  <pre><code>INSERT INTO posts VALUES (7, 1, "A new title", "Some adjusted content");
  </code></pre>
  
  <p>Would that work? or would the id still get an auto incremented value? And even if it did work, am I doing something I shouldn't from a database design point of view, et cetera?</p>